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
Родитель 1c1e3bb26f
Коммит 47ca1c6198
3 изменённых файлов: 13 добавлений и 0 удалений

Просмотреть файл

@ -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);
}

Просмотреть файл

@ -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)

Просмотреть файл

@ -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. */