Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions src/SumatraPDF.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2314,6 +2314,7 @@ extern void SetTabState(WindowTab* tab, TabState* state);

// Call SaveSettings asynchronously to avoid running it in the middle of
// document/tab transitions during document load completion.
// Fixes crashes with dangling tab->ctrl under rapid DDE opens + hooks.
static void SaveSettingsVoid() {
SaveSettings();
}
Expand Down Expand Up @@ -2354,6 +2355,10 @@ MainWindow* LoadDocumentFinish(LoadArgs* args) {
tab->SetFilePath(fullPath);
win->currentTabTemp = AddTabToWindow(win, tab);

if (!IsMainWindowValid(win) || win->isBeingClosed) {
return nullptr;
}

// logf("LoadDocument: !forceReuse, created win->CurrentTab() at 0x%p\n", win->CurrentTab());
} else {
win->CurrentTab()->SetFilePath(fullPath);
Expand Down Expand Up @@ -2389,6 +2394,10 @@ MainWindow* LoadDocumentFinish(LoadArgs* args) {
}
}

if (!IsMainWindowValid(win) || win->isBeingClosed) {
return nullptr;
}

if (gPluginMode) {
// hide the menu for embedded documents opened from the plugin
SetMenu(win->hwndFrame, nullptr);
Expand Down
Loading