mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-05-06 01:50:38 +00:00
GUIInvoke takes a QObject* to avoid callbacks after object lifetime
* The GUIInvoke object takes a QObject, and uses QPointer to check that it hasn't been deleted when the callback fires. This prevents delayed callbacks from executing after the object has been deleted and crashing. * In most cases the pointer is just 'this'.
This commit is contained in:
@@ -233,7 +233,7 @@ void RemoteManager::refreshHost(RDTreeWidgetItem *node)
|
||||
host->CheckStatus();
|
||||
|
||||
GUIInvoke::call(
|
||||
[this, node, host]() { setRemoteServerLive(node, host->serverRunning, host->busy); });
|
||||
this, [this, node, host]() { setRemoteServerLive(node, host->serverRunning, host->busy); });
|
||||
|
||||
uint32_t nextIdent = 0;
|
||||
|
||||
@@ -265,7 +265,7 @@ void RemoteManager::refreshHost(RDTreeWidgetItem *node)
|
||||
|
||||
RemoteConnect tag(host->hostname, host->Name(), nextIdent);
|
||||
|
||||
GUIInvoke::call([this, node, target, running, tag]() {
|
||||
GUIInvoke::call(this, [this, node, target, running, tag]() {
|
||||
RDTreeWidgetItem *child = new RDTreeWidgetItem({target, running});
|
||||
setRemoteConnect(child, tag);
|
||||
node->addChild(child);
|
||||
@@ -276,11 +276,11 @@ void RemoteManager::refreshHost(RDTreeWidgetItem *node)
|
||||
}
|
||||
}
|
||||
|
||||
GUIInvoke::call([node]() { node->setItalic(false); });
|
||||
GUIInvoke::call(this, [node]() { node->setItalic(false); });
|
||||
|
||||
m_Lookups.acquire();
|
||||
|
||||
GUIInvoke::call([this]() { updateStatus(); });
|
||||
GUIInvoke::call(this, [this]() { updateStatus(); });
|
||||
});
|
||||
th->selfDelete(true);
|
||||
th->start();
|
||||
|
||||
Reference in New Issue
Block a user