mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-05-06 10:00:40 +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:
@@ -120,7 +120,7 @@ void ConstantBufferPreviewer::OnEventChanged(uint32_t eventId)
|
||||
m_Ctx.Replay().AsyncInvoke([this, offs, size, wasEmpty](IReplayController *r) {
|
||||
bytebuf data = r->GetBufferData(m_cbuffer, offs, size);
|
||||
rdcarray<ShaderVariable> vars = applyFormatOverride(data);
|
||||
GUIInvoke::call([this, vars, wasEmpty] {
|
||||
GUIInvoke::call(this, [this, vars, wasEmpty] {
|
||||
setVariables(vars);
|
||||
if(wasEmpty)
|
||||
{
|
||||
@@ -135,7 +135,7 @@ void ConstantBufferPreviewer::OnEventChanged(uint32_t eventId)
|
||||
m_Ctx.Replay().AsyncInvoke([this, entryPoint, offs, wasEmpty](IReplayController *r) {
|
||||
rdcarray<ShaderVariable> vars = r->GetCBufferVariableContents(
|
||||
m_shader, entryPoint.toUtf8().data(), m_slot, m_cbuffer, offs);
|
||||
GUIInvoke::call([this, vars, wasEmpty] {
|
||||
GUIInvoke::call(this, [this, vars, wasEmpty] {
|
||||
setVariables(vars);
|
||||
if(wasEmpty)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user