mac: Destroy the app delegate before running destruction callbacks
Otherwise users might be able to access wrapper functions after they are destroyed.
This commit is contained in:
parent
75f49477ca
commit
84410a7e1c
3 changed files with 9 additions and 2 deletions
|
@ -128,6 +128,10 @@ void AtomBrowserMainParts::PostMainMessageLoopStart() {
|
|||
void AtomBrowserMainParts::PostMainMessageLoopRun() {
|
||||
brightray::BrowserMainParts::PostMainMessageLoopRun();
|
||||
|
||||
#if defined(OS_MACOSX)
|
||||
FreeAppDelegate();
|
||||
#endif
|
||||
|
||||
// Make sure destruction callbacks are called before message loop is
|
||||
// destroyed, otherwise some objects that need to be deleted on IO thread
|
||||
// won't be freed.
|
||||
|
|
|
@ -46,7 +46,6 @@ class AtomBrowserMainParts : public brightray::BrowserMainParts {
|
|||
void PostMainMessageLoopRun() override;
|
||||
#if defined(OS_MACOSX)
|
||||
void PreMainMessageLoopStart() override;
|
||||
void PostDestroyThreads() override;
|
||||
#endif
|
||||
|
||||
private:
|
||||
|
@ -56,6 +55,10 @@ class AtomBrowserMainParts : public brightray::BrowserMainParts {
|
|||
void HandleShutdownSignals();
|
||||
#endif
|
||||
|
||||
#if defined(OS_MACOSX)
|
||||
void FreeAppDelegate();
|
||||
#endif
|
||||
|
||||
// A fake BrowserProcess object that used to feed the source code from chrome.
|
||||
scoped_ptr<BrowserProcess> fake_browser_process_;
|
||||
|
||||
|
|
|
@ -34,7 +34,7 @@ void AtomBrowserMainParts::PreMainMessageLoopStart() {
|
|||
setObject:@"NO" forKey:@"NSTreatUnknownArgumentsAsOpen"];
|
||||
}
|
||||
|
||||
void AtomBrowserMainParts::PostDestroyThreads() {
|
||||
void AtomBrowserMainParts::FreeAppDelegate() {
|
||||
[[NSApp delegate] release];
|
||||
[NSApp setDelegate:nil];
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue