libobs-opengl: Fix projector crash with external macOS displays
When an external display is disconnected with a fullscreen projector attached to it, Qt will trigger a resize of the window twice, which makes the renderer queue 2 resize event blocks. At the time when those blocks are run, Qt's window destructor will have reset all pointers, and the block directly accesses pointers within structures identified by pointers, which are invalid by that point. This commit makes a block return early if the associated window has been destroyed already and also explicitly checks for valid pointers after.
This commit is contained in:
parent
b5b3563479
commit
27ba216271
1 changed files with 4 additions and 0 deletions
|
|
@ -228,6 +228,10 @@ void gl_update(gs_device_t *device)
|
|||
NSOpenGLContext *parent = device->plat->context;
|
||||
NSOpenGLContext *context = swap->wi->context;
|
||||
dispatch_async(dispatch_get_main_queue(), ^() {
|
||||
if (!swap || !swap->wi) {
|
||||
return;
|
||||
}
|
||||
|
||||
CGLContextObj parent_obj = [parent CGLContextObj];
|
||||
CGLLockContext(parent_obj);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue