Bug 1127464 - Assert when we unexpectedly unload libraries on Android r=glandium

This commit is contained in:
James Willcox 2015-02-25 15:49:52 -06:00
parent 0f25e1ef1d
commit 64e282f344
3 changed files with 13 additions and 0 deletions

View File

@ -403,7 +403,9 @@ Java_org_mozilla_gecko_mozglue_GeckoLoader_nativeRun(JNIEnv *jenv, jclass jc, js
char *args = (char *) malloc(len + 1);
jenv->GetStringUTFRegion(jargs, 0, len, args);
args[len] = '\0';
ElfLoader::Singleton.ExpectShutdown(false);
GeckoStart(args, &sAppData);
ElfLoader::Singleton.ExpectShutdown(true);
free(args);
}

View File

@ -510,6 +510,10 @@ ElfLoader::~ElfLoader()
{
LibHandleList list;
if (!Singleton.IsShutdownExpected()) {
MOZ_CRASH("Unexpected shutdown");
}
/* Release self_elf and libc */
self_elf = nullptr;
#if defined(ANDROID)

View File

@ -431,6 +431,12 @@ public:
*/
static Mappable *GetMappableFromPath(const char *path);
void ExpectShutdown(bool val) { expect_shutdown = val; }
bool IsShutdownExpected() { return expect_shutdown; }
private:
bool expect_shutdown;
protected:
/**
* Registers the given handle. This method is meant to be called by
@ -454,6 +460,7 @@ protected:
const char *lastError;
private:
ElfLoader() : expect_shutdown(true) {}
~ElfLoader();
/* Initialization code that can't run during static initialization. */