mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Don't use a static nsCString (causing leaks in the plugin process). Also, use NS_LogInit/NS_LogTerm for the child process so that leaks are reported at the right time.
This commit is contained in:
parent
e9917531bc
commit
8f0adb5fe2
@ -61,8 +61,6 @@ using namespace mozilla::plugins;
|
||||
|
||||
namespace {
|
||||
PluginModuleChild* gInstance = nsnull;
|
||||
// NPN_UserAgent returns a |const char*| that must outlive its stack frame
|
||||
nsCString gUserAgent;
|
||||
}
|
||||
|
||||
|
||||
@ -205,6 +203,15 @@ PluginModuleChild::CleanUp()
|
||||
{
|
||||
}
|
||||
|
||||
const char*
|
||||
PluginModuleChild::GetUserAgent()
|
||||
{
|
||||
if (!CallNPN_UserAgent(&mUserAgent))
|
||||
return NULL;
|
||||
|
||||
return NullableStringGet(mUserAgent);
|
||||
}
|
||||
|
||||
bool
|
||||
PluginModuleChild::RegisterNPObject(NPObject* aObject,
|
||||
PluginScriptableObjectChild* aActor)
|
||||
@ -765,8 +772,7 @@ _useragent(NPP aNPP)
|
||||
_MOZ_LOG(__FUNCTION__);
|
||||
AssertPluginThread();
|
||||
|
||||
PluginModuleChild::current()->CallNPN_UserAgent(&gUserAgent);
|
||||
return NullableStringGet(gUserAgent);
|
||||
return PluginModuleChild::current()->GetUserAgent();
|
||||
}
|
||||
|
||||
void* NP_CALLBACK
|
||||
|
@ -137,6 +137,8 @@ public:
|
||||
|
||||
void CleanUp();
|
||||
|
||||
const char* GetUserAgent();
|
||||
|
||||
static const NPNetscapeFuncs sBrowserFuncs;
|
||||
|
||||
static PluginModuleChild* current();
|
||||
@ -157,6 +159,7 @@ private:
|
||||
|
||||
std::string mPluginFilename;
|
||||
PRLibrary* mLibrary;
|
||||
nsCString mUserAgent;
|
||||
|
||||
// we get this from the plugin
|
||||
#ifdef OS_POSIX
|
||||
|
@ -287,9 +287,13 @@ XRE_InitChildProcess(int aArgc,
|
||||
|
||||
base::AtExitManager exitManager;
|
||||
|
||||
NS_LogInit();
|
||||
|
||||
int rv = XRE_InitCommandLine(aArgc, aArgv);
|
||||
if (NS_FAILED(rv))
|
||||
return NS_ERROR_FAILURE;
|
||||
if (NS_FAILED(rv)) {
|
||||
NS_LogTerm();
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
MessageLoopForIO mainMessageLoop;
|
||||
|
||||
@ -331,6 +335,7 @@ XRE_InitChildProcess(int aArgc,
|
||||
sIOMessageLoop = nsnull;
|
||||
}
|
||||
|
||||
NS_LogTerm();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user