mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-09-21 00:55:09 -07:00
[DeckShare] Wire the status-changed handler after shareBar exists
handleConnectionChanged() dereferences shareBar->isVisible(), but the connection was set up before shareBar was constructed and shareBar had no in-class initializer. On any status change delivered before construction the slot read an indeterminate pointer. Seed the connection (and the initial share availability) after shareBar exists and give shareBar a = nullptr initializer.
This commit is contained in:
parent
2cf03124de
commit
26b17f8435
2 changed files with 5 additions and 5 deletions
|
|
@ -38,10 +38,6 @@ TabDeckStorageVisual::TabDeckStorageVisual(TabSupervisor *_tabSupervisor, Abstra
|
|||
}
|
||||
});
|
||||
|
||||
connect(client, &AbstractClient::statusChanged, this, &TabDeckStorageVisual::handleConnectionChanged);
|
||||
shareDeckAvailable = (client->getStatus() == StatusLoggedIn);
|
||||
visualDeckStorageWidget->setShareAvailable(shareDeckAvailable);
|
||||
|
||||
auto *widget = new QWidget(this);
|
||||
auto *layout = new QVBoxLayout(widget);
|
||||
layout->setContentsMargins(0, 0, 0, 0);
|
||||
|
|
@ -57,6 +53,10 @@ TabDeckStorageVisual::TabDeckStorageVisual(TabSupervisor *_tabSupervisor, Abstra
|
|||
layout->insertWidget(0, shareBar);
|
||||
shareBar->setVisible(false);
|
||||
|
||||
connect(client, &AbstractClient::statusChanged, this, &TabDeckStorageVisual::handleConnectionChanged);
|
||||
shareDeckAvailable = (client->getStatus() == StatusLoggedIn);
|
||||
visualDeckStorageWidget->setShareAvailable(shareDeckAvailable);
|
||||
|
||||
shareTimeoutTimer->setSingleShot(true);
|
||||
shareTimeoutTimer->setInterval(
|
||||
static_cast<int>((static_cast<qint64>(SettingsCache::instance().network().getTimeOut()) + 1) *
|
||||
|
|
|
|||
|
|
@ -74,7 +74,7 @@ private:
|
|||
|
||||
VisualDeckStorageWidget *visualDeckStorageWidget;
|
||||
|
||||
ShareBarWidget *shareBar;
|
||||
ShareBarWidget *shareBar = nullptr;
|
||||
AbstractClient *client;
|
||||
QTimer *shareTimeoutTimer;
|
||||
int shareRequestSeq = 0;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue