mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 951120 - Don't process native events on the main thread during xpcom shutdown in metro widget. r=bbondy
This commit is contained in:
parent
69cbc0bbff
commit
21f0fe30cc
@ -42,6 +42,7 @@ namespace winrt {
|
||||
ComPtr<FrameworkView> sFrameworkView;
|
||||
ComPtr<MetroApp> sMetroApp;
|
||||
ComPtr<ICoreApplication> sCoreApp;
|
||||
bool MetroApp::sGeckoShuttingDown = false;
|
||||
|
||||
////////////////////////////////////////////////////
|
||||
// IFrameworkViewSource impl.
|
||||
@ -109,6 +110,8 @@ MetroApp::ShutdownXPCOM()
|
||||
sFrameworkView->ShutdownXPCOM();
|
||||
}
|
||||
|
||||
MetroApp::sGeckoShuttingDown = true;
|
||||
|
||||
// Shut down xpcom
|
||||
XRE_metroShutdown();
|
||||
|
||||
|
@ -46,6 +46,8 @@ public:
|
||||
void CoreExit();
|
||||
|
||||
void ShutdownXPCOM();
|
||||
// Set when gecko enters xpcom shutdown.
|
||||
static bool sGeckoShuttingDown;
|
||||
|
||||
// Shared pointers between framework and widget
|
||||
static void SetBaseWidget(MetroWidget* aPtr);
|
||||
|
@ -324,8 +324,8 @@ MetroAppShell::InputEventsDispatched()
|
||||
void
|
||||
MetroAppShell::DispatchAllGeckoEvents()
|
||||
{
|
||||
// Only do this if requested
|
||||
if (!sShouldPurgeThreadQueue) {
|
||||
// Only do this if requested and when we're not shutting down
|
||||
if (!sShouldPurgeThreadQueue || MetroApp::sGeckoShuttingDown) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -414,6 +414,15 @@ void
|
||||
MetroAppShell::NativeCallback()
|
||||
{
|
||||
NS_ASSERTION(NS_IsMainThread(), "Native callbacks must be on the metro main thread");
|
||||
|
||||
// We shouldn't process native events during xpcom shutdown - this can
|
||||
// trigger unexpected xpcom event dispatching for the main thread when
|
||||
// the thread manager is in the process of shutting down non-main threads,
|
||||
// resulting in shutdown hangs.
|
||||
if (MetroApp::sGeckoShuttingDown) {
|
||||
return;
|
||||
}
|
||||
|
||||
NativeEventCallback();
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user