mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 913138 - Release nsLayoutStatics when the layout module is unloaded. r=bsmedberg
This commit is contained in:
parent
8f90e44d21
commit
b82938ad2f
@ -352,35 +352,6 @@ NS_GENERIC_FACTORY_SINGLETON_CONSTRUCTOR(nsITelephonyProvider,
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
// Per bug 209804, it is necessary to observe the "xpcom-shutdown" event and
|
||||
// perform shutdown of the layout modules at that time instead of waiting for
|
||||
// our module destructor to run. If we do not do this, then we risk holding
|
||||
// references to objects in other component libraries that have already been
|
||||
// shutdown (and possibly unloaded if 60709 is ever fixed).
|
||||
|
||||
class LayoutShutdownObserver MOZ_FINAL : public nsIObserver
|
||||
{
|
||||
public:
|
||||
NS_DECL_ISUPPORTS
|
||||
NS_DECL_NSIOBSERVER
|
||||
};
|
||||
|
||||
NS_IMPL_ISUPPORTS1(LayoutShutdownObserver, nsIObserver)
|
||||
|
||||
NS_IMETHODIMP
|
||||
LayoutShutdownObserver::Observe(nsISupports *aSubject,
|
||||
const char *aTopic,
|
||||
const char16_t *someData)
|
||||
{
|
||||
if (!strcmp(aTopic, NS_XPCOM_SHUTDOWN_OBSERVER_ID)) {
|
||||
Shutdown();
|
||||
nsContentUtils::XPCOMShutdown();
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
static bool gInitialized = false;
|
||||
|
||||
// Perform our one-time intialization for this module
|
||||
@ -411,24 +382,6 @@ Initialize()
|
||||
return rv;
|
||||
}
|
||||
|
||||
// Add our shutdown observer.
|
||||
nsCOMPtr<nsIObserverService> observerService =
|
||||
mozilla::services::GetObserverService();
|
||||
|
||||
if (observerService) {
|
||||
LayoutShutdownObserver* observer = new LayoutShutdownObserver();
|
||||
|
||||
if (!observer) {
|
||||
Shutdown();
|
||||
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
observerService->AddObserver(observer, NS_XPCOM_SHUTDOWN_OBSERVER_ID, false);
|
||||
} else {
|
||||
NS_WARNING("Could not get an observer service. We will leak on shutdown.");
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
nsStyleContext::AssertStyleStructMaxDifferenceValid();
|
||||
#endif
|
||||
@ -1293,6 +1246,8 @@ static const mozilla::Module::CategoryEntry kLayoutCategories[] = {
|
||||
static void
|
||||
LayoutModuleDtor()
|
||||
{
|
||||
Shutdown();
|
||||
nsContentUtils::XPCOMShutdown();
|
||||
nsScriptSecurityManager::Shutdown();
|
||||
xpcModuleDtor();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user