mirror of
https://github.com/Relintai/sdl2_frt.git
synced 2024-12-16 11:06:49 +01:00
Fix use-after-free when pumping the event loop after SDL_DestroyWindow()
Closing the window is asynchronous, but we free the window data immediately, so we can get an updateLayer callback before the window is really destroyed which will cause us to access the freed memory. Clearing the content view will cause it to be immediately released, so no further updateLayer callbacks will occur.
This commit is contained in:
parent
a4e33b9cc4
commit
9b2202828a
@ -1816,6 +1816,8 @@ Cocoa_DestroyWindow(_THIS, SDL_Window * window)
|
|||||||
[data->listener close];
|
[data->listener close];
|
||||||
[data->listener release];
|
[data->listener release];
|
||||||
if (data->created) {
|
if (data->created) {
|
||||||
|
/* Release the content view to avoid further updateLayer callbacks */
|
||||||
|
[data->nswindow setContentView:nil];
|
||||||
[data->nswindow close];
|
[data->nswindow close];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user