Skip to content

Commit

Permalink
Destroy threadGlobalData in ShutdownOnce
Browse files Browse the repository at this point in the history
Should fix WebKit#18118

Also call that function in DumpRenderTree shutdown so it doesn't crash.
  • Loading branch information
pulkomandy committed Jul 29, 2023
1 parent 2f9ee11 commit 2ad576a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
8 changes: 5 additions & 3 deletions Source/WebKitLegacy/haiku/API/WebPage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@
#include "WebCore/ResourceRequest.h"
#include "WebCore/ScriptController.h"
#include "WebCore/Settings.h"
#include "WebCore/ThreadGlobalData.h"
#include "WebCore/UserContentController.h"
#include <WebCore/WebLockRegistry.h>

Expand Down Expand Up @@ -182,7 +183,6 @@ void WebKitInitializeLogChannelsIfNecessary();
// NOTE: This needs to be called when the BApplication is ready.
// It won't work as static initialization.
#if !LOG_DISABLED
logChannels().initializeLogChannelsIfNecessary(String::fromUTF8("all=all"));
WebKitInitializeLogChannelsIfNecessary();
#endif
PlatformStrategiesHaiku::initialize();
Expand Down Expand Up @@ -211,7 +211,9 @@ void WebKitInitializeLogChannelsIfNecessary();
WebKit::iconDatabase().close();

// There is a crash on exit if the font cache is not empty, so make sure it is
// Destroying the thread global data also helps cutting that dependency cycle
WebCore::FontCache::invalidateAllFontCaches(WebCore::FontCache::ShouldRunInvalidationCallback::No);
WebCore::threadGlobalData().destroy();
}

/*static*/ void BWebPage::SetCacheModel(BWebKitCacheModel model)
Expand Down Expand Up @@ -782,8 +784,8 @@ void BWebPage::requestDownload(const WebCore::ResourceRequest& request,

void BWebPage::paint(BRect rect, bool immediate)
{
if (!rect.IsValid())
return;
if (!rect.IsValid())
return;
// Block any drawing as long as the BWebView is hidden
// (should be extended to when the containing BWebWindow is not
// currently on screen either...)
Expand Down
1 change: 1 addition & 0 deletions Tools/DumpRenderTree/haiku/DumpRenderTree.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -419,6 +419,7 @@ class DumpRenderTreeApp : public BApplication, WebCore::DumpRenderTreeClient {
DumpRenderTreeApp();
~DumpRenderTreeApp() {
delete m_webWindow->CurrentWebView();
BWebPage::ShutdownOnce();
}

// BApplication
Expand Down

0 comments on commit 2ad576a

Please sign in to comment.