mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 804828 - Talagent trips ValidWriteAssert (when Firefox tries to restart in safe mode due to previous crashes). r=ted.
--HG-- extra : rebase_source : dd4a3dec5204181a4c421d84daccf9ea172757c8
This commit is contained in:
parent
fc13d2d51e
commit
f622a625c9
@ -129,6 +129,7 @@ using mozilla::unused;
|
||||
#include "nsINIParser.h"
|
||||
#include "mozilla/Omnijar.h"
|
||||
#include "mozilla/StartupTimeline.h"
|
||||
#include "mozilla/mozPoisonWrite.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
@ -3874,6 +3875,10 @@ XREMain::XRE_main(int argc, char* argv[], const nsXREAppData* aAppData)
|
||||
// corresponds to nsIAppStartup.quit(eRestart)
|
||||
if (rv == NS_SUCCESS_RESTART_APP) {
|
||||
appInitiatedRestart = true;
|
||||
} else {
|
||||
// We will have a real shutdown, let ShutdownXPCOM poison writes to
|
||||
// find any late ones.
|
||||
mozilla::EnableWritePoisoning();
|
||||
}
|
||||
|
||||
if (!mShuttingDown) {
|
||||
|
@ -17,5 +17,6 @@ MOZ_END_EXTERN_C
|
||||
namespace mozilla {
|
||||
void PoisonWrite();
|
||||
void DisableWritePoisoning();
|
||||
void EnableWritePoisoning();
|
||||
}
|
||||
#endif
|
||||
|
@ -276,7 +276,14 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
bool PoisoningDisabled = false;
|
||||
// This variable being true has two consequences
|
||||
// * It prevents PoisonWrite from patching the write functions.
|
||||
// * If the patching has already been done, it prevents AbortOnBadWrite from
|
||||
// asserting. Note that not all writes use AbortOnBadWrite at this point
|
||||
// (aio_write for example), so disabling writes after patching doesn't
|
||||
// completely undo it.
|
||||
bool PoisoningDisabled = true;
|
||||
|
||||
void AbortOnBadWrite(int fd, const void *wbuf, size_t count) {
|
||||
if (PoisoningDisabled)
|
||||
return;
|
||||
@ -375,7 +382,15 @@ extern "C" {
|
||||
|
||||
namespace mozilla {
|
||||
void PoisonWrite() {
|
||||
PoisoningDisabled = false;
|
||||
// Quick sanity check that we don't poison twice.
|
||||
static bool WritesArePoisoned = false;
|
||||
MOZ_ASSERT(!WritesArePoisoned);
|
||||
if (WritesArePoisoned)
|
||||
return;
|
||||
WritesArePoisoned = true;
|
||||
|
||||
if (PoisoningDisabled)
|
||||
return;
|
||||
|
||||
nsCOMPtr<nsIFile> mozFile;
|
||||
NS_GetSpecialDirectory(NS_APP_USER_PROFILE_50_DIR, getter_AddRefs(mozFile));
|
||||
@ -404,4 +419,7 @@ void PoisonWrite() {
|
||||
void DisableWritePoisoning() {
|
||||
PoisoningDisabled = true;
|
||||
}
|
||||
void EnableWritePoisoning() {
|
||||
PoisoningDisabled = false;
|
||||
}
|
||||
}
|
||||
|
@ -10,6 +10,8 @@ void PoisonWrite() {
|
||||
}
|
||||
void DisableWritePoisoning() {
|
||||
}
|
||||
void EnableWritePoisoning() {
|
||||
}
|
||||
}
|
||||
extern "C" {
|
||||
void MozillaRegisterDebugFD(int fd) {
|
||||
|
Loading…
Reference in New Issue
Block a user