UI: Close display before native surfaces
This hooks the platform specific events in order to close the obs display more accurately. Earlier attempts on hooking visiblity, but Qt does not ensure that visibility is changed before the surface is destroyed. So we ended up racing with the EGL driver and on some drivers if you lose the race they hang. Also only force display creation if the display is actually visible. When a source type is not video/drawable (or is missing) this would force the display to be created for the blank window and also hang. Finally force closure of the preview displays during scene cleanup to avoid similar ordering issues in Qt. Qt has even less order guarentees during close and we are sure that displays are no longer needed at this point in the UI.
This commit is contained in:
parent
29759ef8fb
commit
f8d415afbe
@ -42,6 +42,9 @@ protected:
|
||||
else
|
||||
mTimerId = startTimer(67); // Arbitrary
|
||||
break;
|
||||
case QPlatformSurfaceEvent::SurfaceAboutToBeDestroyed:
|
||||
display->DestroyDisplay();
|
||||
break;
|
||||
case QEvent::Expose:
|
||||
createOBSDisplay();
|
||||
break;
|
||||
@ -52,7 +55,10 @@ protected:
|
||||
return result;
|
||||
}
|
||||
|
||||
void timerEvent(QTimerEvent *) { createOBSDisplay(true); }
|
||||
void timerEvent(QTimerEvent *)
|
||||
{
|
||||
createOBSDisplay(display->isVisible());
|
||||
}
|
||||
|
||||
private:
|
||||
void createOBSDisplay(bool force = false)
|
||||
|
@ -43,6 +43,7 @@ public:
|
||||
void SetDisplayBackgroundColor(const QColor &color);
|
||||
void UpdateDisplayBackgroundColor();
|
||||
void CreateDisplay(bool force = false);
|
||||
void DestroyDisplay() { display = nullptr; };
|
||||
|
||||
void OnMove();
|
||||
void OnDisplayChange();
|
||||
|
@ -4707,6 +4707,10 @@ void OBSBasic::closeEvent(QCloseEvent *event)
|
||||
|
||||
delete extraBrowsers;
|
||||
|
||||
ui->preview->DestroyDisplay();
|
||||
if (program)
|
||||
program->DestroyDisplay();
|
||||
|
||||
config_set_string(App()->GlobalConfig(), "BasicWindow", "DockState",
|
||||
saveState().toBase64().constData());
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user