Skip to content

Commit 368d122

Browse files
committed
Revert "Fix #8962 (Destroying browser onClientGUIClick result instant crash)"
This reverts commit 71dd957.
1 parent a7be0f7 commit 368d122

File tree

2 files changed

+9
-7
lines changed

2 files changed

+9
-7
lines changed

Client/mods/deathmatch/logic/CClientWebBrowser.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -335,9 +335,8 @@ CClientGUIWebBrowser::CClientGUIWebBrowser ( bool isLocal, bool isTransparent, u
335335
: CClientGUIElement ( pManager, pLuaMain, pCGUIElement, ID )
336336
{
337337
m_pManager = pManager;
338-
m_pBrowser.reset(g_pClientGame->GetManager()->GetRenderElementManager()->CreateWebBrowser(width, height, isLocal, isTransparent));
339-
m_pBrowser->SetParent(this); // Memory management is no longer done via element tree logic, but is kept here for backwards compatibility
340-
m_pBrowser->MakeSystemEntity(); // Mark element as system entity so it isn't destroyed automatically
338+
m_pBrowser = g_pClientGame->GetManager ()->GetRenderElementManager ()->CreateWebBrowser ( width, height, isLocal, isTransparent );
339+
m_pBrowser->SetParent ( this ); // m_pBrowser gets deleted automatically by the element tree logic
341340

342341
// Set our owner resource
343342
m_pBrowser->SetResource ( pLuaMain->GetResource () );

Client/mods/deathmatch/logic/CClientWebBrowser.h

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,10 @@
77
* PURPOSE: ClientEntity webbrowser tab class
88
*
99
*****************************************************************************/
10-
#pragma once
1110

12-
#include <memory>
11+
#ifndef __CCLIENTWEBBROWSER_H
12+
#define __CCLIENTWEBBROWSER_H
13+
1314
#include <core/CWebViewInterface.h>
1415
#include <core/CAjaxResourceHandlerInterface.h>
1516
#include <core/CWebBrowserEventsInterface.h>
@@ -95,8 +96,10 @@ class CClientGUIWebBrowser : public CClientGUIElement
9596
public:
9697
CClientGUIWebBrowser ( bool isLocal, bool isTransparent, uint width, uint height, CClientManager* pManager, CLuaMain* pLuaMain, CGUIElement* pCGUIElement, ElementID ID = INVALID_ELEMENT_ID );
9798

98-
inline CClientWebBrowser* GetBrowser () { return m_pBrowser.get(); }
99+
inline CClientWebBrowser* GetBrowser () { return m_pBrowser; }
99100

100101
private:
101-
std::unique_ptr<CClientWebBrowser> m_pBrowser;
102+
CClientWebBrowser* m_pBrowser;
102103
};
104+
105+
#endif

0 commit comments

Comments
 (0)