UI: Delete OBSDisplay on window hide on unix

When a window with an OBSQTDisplay is closed, the surface can be
destroyed before the display is, opening a gap for OBS to attempt to
draw to the invalid surface.

This deletes the underlying OBSDisplay object when the actual surface
is destroyed, closing that gap.

Note: This appears to have been an issue previously with Wayland, as
hinted by the existing ifdefs.
master
tt2468 2021-11-20 23:02:52 -08:00 committed by Jim
parent 2fa145899f
commit 44f07f9b11
1 changed files with 2 additions and 3 deletions

View File

@ -90,9 +90,8 @@ OBSQTDisplay::OBSQTDisplay(QWidget *parent, Qt::WindowFlags flags)
auto windowVisible = [this](bool visible) {
if (!visible) {
#ifdef ENABLE_WAYLAND
if (obs_get_nix_platform() == OBS_NIX_PLATFORM_WAYLAND)
display = nullptr;
#if !defined(_WIN32) && !defined(__APPLE__)
display = nullptr;
#endif
return;
}