mirror of
https://github.com/transmission/transmission
synced 2025-01-30 19:03:04 +00:00
fixup! fix: dangling reference crash in FreeSpaceLabel (#1604)
This commit is contained in:
parent
5c8f7d410c
commit
16ec15d84b
1 changed files with 14 additions and 22 deletions
|
@ -73,17 +73,12 @@ void FreeSpaceLabel::onTimer()
|
|||
|
||||
auto* q = new RpcQueue(this);
|
||||
|
||||
auto* alive = new bool(true);
|
||||
connect(this, &QObject::destroyed, [alive] { *alive = false; });
|
||||
|
||||
q->add([this, &args]()
|
||||
{
|
||||
return session_->exec("free-space", &args);
|
||||
});
|
||||
|
||||
q->add([this, alive](RpcResponse const& r)
|
||||
{
|
||||
if (*alive)
|
||||
q->add([this](RpcResponse const& r)
|
||||
{
|
||||
// update the label
|
||||
auto const bytes = dictFind<int64_t>(r.args.get(), TR_KEY_size_bytes);
|
||||
|
@ -93,7 +88,7 @@ void FreeSpaceLabel::onTimer()
|
|||
}
|
||||
else
|
||||
{
|
||||
clear();
|
||||
setText(QString());
|
||||
}
|
||||
|
||||
// update the tooltip
|
||||
|
@ -101,9 +96,6 @@ void FreeSpaceLabel::onTimer()
|
|||
setToolTip(QDir::toNativeSeparators(path ? *path : QString()));
|
||||
|
||||
timer_.start();
|
||||
}
|
||||
|
||||
delete alive;
|
||||
});
|
||||
|
||||
q->run();
|
||||
|
|
Loading…
Reference in a new issue