The platform display is not owned by libobs, it should not
be closed. Doing so results in heap use-after-frees when
Qt components try to use it while trying to show
a message box about the failure:
info: Initializing OpenGL...
error: Failed to initialize EGL: EGL_BAD_ACCESS
error: Failed to create context!
error: device_create (GL) failed
error: Failed to initialize video. Your GPU may not be supported, or your graphics drivers may need to be updated.
=================================================================
==2320345==ERROR: AddressSanitizer: heap-use-after-free on address 0x621000018668 at pc 0x7fcb75e20d6e bp 0x7ffe88d0e910 sp 0x7ffe88d0e900
READ of size 8 at 0x621000018668 thread T0
0 0x7fcb75e20d6d in XInternAtom /.../libx11/src/IntAtom.c:175
1 0x7fcb6bf5edfd in Kvantum::ThemeConfig::getCompositeSpec()
2 0x7fcb6bf0eb19 in Kvantum::Style::setSurfaceFormat(QWidget*) const
3 0x7fcb6bf11bae in Kvantum::Style::styleHint(QStyle::StyleHint, QStyleOption const*, QWidget const*, QStyleHintReturn*) const
4 0x5585cbce70b8 in OBSIgnoreWheelProxyStyle::styleHint(QStyle::StyleHint, QStyleOption const*, QWidget const*, QStyleHintReturn*) const /.../obs-studio/UI/obs-proxy-style.cpp:88
5 0x7fcb85826515 (/usr/lib/libQt6Widgets.so.6+0x226515)
6 0x7fcb859dbf1d (/usr/lib/libQt6Widgets.so.6+0x3dbf1d)
7 0x7fcb859dc5f0 in QMessageBox::QMessageBox(...)
8 0x7fcb859dc6b1 (/usr/lib/libQt6Widgets.so.6+0x3dc6b1)
9 0x5585cbd2fb31 in OBSErrorBoxva /.../obs-studio/UI/qt-wrappers.cpp:48
10 0x5585cbd2fd34 in OBSErrorBox(QWidget*, char const*, ...) /.../obs-studio/UI/qt-wrappers.cpp:55
11 0x5585cbcc3f36 in run_program /.../obs-studio/UI/obs-app.cpp:2475
12 0x5585cbcc52b4 in main /.../obs-studio/UI/obs-app.cpp:3358
13 0x7fcb82e3c28f (/usr/lib/libc.so.6+0x2328f)
14 0x7fcb82e3c349 in __libc_start_main
15 0x5585cbbd2f54 in _start
Fixes: 137966e01f ("libobs-opengl: Try to use the platform display if available")