Commit 0a8e2d77 authored by lassoan's avatar lassoan

BUG: Prevent confirm close dialog from showing twice

This was due to a Mac-specific Qt bug (https://bugreports.qt.io/browse/QTBUG-43344). Fixed using a simple flag preventing the second event to be handled.
Co-authored-by: Csaba Pinter's avatarCsaba Pinter <csaba.pinter@queensu.ca>

git-svn-id: http://svn.slicer.org/Slicer4/trunk@28012 3bd1e089-480b-0410-8dfb-8563597acbee
parent c966c489
......@@ -111,6 +111,7 @@ qSlicerMainWindowPrivate::qSlicerMainWindowPrivate(qSlicerMainWindow& object)
this->ModuleSelectorToolBar = 0;
this->LayoutManager = 0;
this->WindowInitialShowCompleted = false;
this->IsClosing = false;
}
//-----------------------------------------------------------------------------
......@@ -1099,6 +1100,16 @@ void qSlicerMainWindow::onFileRecentLoadedActionTriggered()
void qSlicerMainWindow::closeEvent(QCloseEvent *event)
{
Q_D(qSlicerMainWindow);
// This is necessary because of a Qt bug on MacOS.
// (https://bugreports.qt.io/browse/QTBUG-43344).
// This flag prevents a second close event to be handled.
if (d->IsClosing)
{
return;
}
d->IsClosing = true;
if (d->confirmCloseApplication())
{
// Exit current module to leave it a chance to change the UI (e.g. layout)
......
......@@ -81,6 +81,7 @@ public:
QByteArray StartupState;
bool WindowInitialShowCompleted;
bool IsClosing;
};
#endif
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment