mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-09-22 17:45:09 -07:00
[Client] Only quit on update when the shutdown actually ran
MainWindow::closeEvent has a static re-entrancy guard that returns early on a second close event, leaving it in its default accepted state. DlgUpdate reached from a nested event loop while a shutdown prompt was up could then get close() == true with no shutdown work done (no settings flush, no tab shutdown) and tear down the process behind an unanswered prompt. Add MainWindow::closeForUpdate(), which reports false when a close is already in progress or was vetoed, and gate the update-exit on it.
This commit is contained in:
parent
adc74bd57c
commit
00dcc0d5c1
3 changed files with 25 additions and 4 deletions
|
|
@ -167,6 +167,7 @@ private:
|
|||
LagMonitor lagMonitor; ///< watches the main thread for event loop stalls
|
||||
LatencyStatusWidget *latencyStatus = nullptr; ///< status bar widget with live round-trip stats and history graph
|
||||
bool bHasActivated, askedForDbUpdater;
|
||||
bool bClosingDown = false; ///< guards closeEvent() against re-entrancy
|
||||
bool skipStartupAutoConnect = false;
|
||||
bool startupAutoConnectAttempted = false;
|
||||
QProcess *cardUpdateProcess;
|
||||
|
|
@ -204,6 +205,13 @@ public:
|
|||
return tabSupervisor;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Closes the window so an update installer can replace the running binaries.
|
||||
* Returns true only if the shutdown actually ran (settings flushed, tabs shut down);
|
||||
* false if the close was vetoed by the user or is already in progress.
|
||||
*/
|
||||
bool closeForUpdate();
|
||||
|
||||
protected:
|
||||
void closeEvent(QCloseEvent *event) override;
|
||||
void changeEvent(QEvent *event) override;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue