Skip to content

Commit 945427a

Browse files
authored
Merge pull request #3657 from Goober5000/fix_3654
fix the cancel behavior when FRED is closed
2 parents e2a359b + 5fb9a6f commit 945427a

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

fred2/mainfrm.cpp

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,17 @@ void CMainFrame::init_tools() {
144144
m_new_ship_type_combo_box.SetCurSel(0);
145145
}
146146

147-
void CMainFrame::OnClose() {
147+
void CMainFrame::OnClose()
148+
{
149+
// CFrameWnd::OnClose() doesn't provide a way for the caller to tell that the close has been cancelled,
150+
// so let's extract that particular logic and do it manually here
151+
if (!FREDDoc_ptr->SaveModified())
152+
return;
153+
154+
// and now if we *are* closing, prevent the dialog from coming up
155+
FREDDoc_ptr->SetModifiedFlag(FALSE);
156+
157+
// do the closing stuff
148158
theApp.write_ini_file();
149159
SaveBarState("Tools state");
150160
CFrameWnd::OnClose();

0 commit comments

Comments
 (0)