mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-04-27 07:48:01 -07:00
Refactor: Don't call stop in TabSupervisor dtor (#6061)
This commit is contained in:
parent
62c02e3fce
commit
e10dd4ef42
1 changed files with 10 additions and 21 deletions
|
|
@ -182,7 +182,16 @@ TabSupervisor::TabSupervisor(AbstractClient *_client, QMenu *tabsMenu, QWidget *
|
|||
|
||||
TabSupervisor::~TabSupervisor()
|
||||
{
|
||||
stop();
|
||||
// Note: this used to call stop(), but stop() is doing a bunch of stuff including emitting some signals,
|
||||
// and we don't want to do that in a destructor.
|
||||
|
||||
for (auto &localClient : localClients) {
|
||||
localClient->deleteLater();
|
||||
}
|
||||
localClients.clear();
|
||||
|
||||
delete userInfo;
|
||||
userInfo = nullptr;
|
||||
}
|
||||
|
||||
void TabSupervisor::retranslateUi()
|
||||
|
|
@ -268,26 +277,6 @@ void TabSupervisor::closeEvent(QCloseEvent *event)
|
|||
event->ignore();
|
||||
}
|
||||
}
|
||||
|
||||
// Close the game tabs in order to make sure they store their layout.
|
||||
QSet<int> gameTabsToRemove;
|
||||
for (auto it = gameTabs.begin(), end = gameTabs.end(); it != end; ++it) {
|
||||
if (it.value()->close()) {
|
||||
// Hotfix: the tab owns the `QMenu`s so they need to be cleared,
|
||||
// otherwise we end up with use-after-free bugs.
|
||||
if (it.value() == currentWidget()) {
|
||||
emit setMenu();
|
||||
}
|
||||
|
||||
gameTabsToRemove.insert(it.key());
|
||||
} else {
|
||||
event->ignore();
|
||||
}
|
||||
}
|
||||
|
||||
for (auto tabId : gameTabsToRemove) {
|
||||
gameTabs.remove(tabId);
|
||||
}
|
||||
}
|
||||
|
||||
AbstractClient *TabSupervisor::getClient() const
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue