mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-07-08 08:40:55 +00:00
Track preview when calling UI callbacks to avoid use-after-free
This commit is contained in:
@@ -2424,7 +2424,7 @@ void TextureViewer::InitResourcePreview(ResourcePreview *prev, BoundResource res
|
||||
prev->setProperty("slice", sub.slice);
|
||||
prev->setProperty("cast", uint32_t(res.typeCast));
|
||||
|
||||
GUIInvoke::call(this, [this, prev] { UI_PreviewResized(prev); });
|
||||
GUIInvoke::call(prev, [this, prev] { UI_PreviewResized(prev); });
|
||||
}
|
||||
|
||||
void TextureViewer::UI_PreviewResized(ResourcePreview *prev)
|
||||
@@ -2444,7 +2444,7 @@ void TextureViewer::UI_PreviewResized(ResourcePreview *prev)
|
||||
// new and swap to move the data into the lambda
|
||||
bytebuf *copy = new bytebuf;
|
||||
copy->swap(data);
|
||||
GUIInvoke::call(this, [prev, s, copy]() {
|
||||
GUIInvoke::call(prev, [prev, s, copy]() {
|
||||
prev->UpdateThumb(s, *copy);
|
||||
delete copy;
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user