[vlc-commits] [Git][videolan/vlc][master] 4 commits: qt: fix `QVLCDialog::setWindowTransientParent()` trying to get non-existing main window

Steve Lhomme (@robUx4) gitlab at videolan.org
Fri Jul 26 08:46:03 UTC 2024



Steve Lhomme pushed to branch master at VideoLAN / VLC


Commits:
d5091198 by Fatih Uzunoglu at 2024-07-26T08:33:56+00:00
qt: fix `QVLCDialog::setWindowTransientParent()` trying to get non-existing main window

When `b_isDialogProvider` is set, the main window is not shown, and
`p_intf->p_compositor` is a null pointer.

- - - - -
72824a90 by Fatih Uzunoglu at 2024-07-26T08:33:56+00:00
qt: assert `p_compositor` in `QVLCDialog::setWindowTransientParent()`

When `b_isDialogProvider` is false, the main window is shown, a
compositor is expected to be available.

For that reason, assert `p_compositor`.

- - - - -
273a4d85 by Fatih Uzunoglu at 2024-07-26T08:33:56+00:00
qt: assert that widget is a window in `QVLCDialog::setWindowTransientParent()`

- - - - -
4d920c8f by Fatih Uzunoglu at 2024-07-26T08:33:56+00:00
qt: use `QWidget::isWindow()` instead of `windowFlags().testFlag(Qt::Window)`

- - - - -


1 changed file:

- modules/gui/qt/widgets/native/qvlcframe.cpp


Changes:

=====================================
modules/gui/qt/widgets/native/qvlcframe.cpp
=====================================
@@ -200,7 +200,7 @@ QVLCFrame::QVLCFrame(qt_intf_t *_p_intf) : QWidget( NULL ), p_intf( _p_intf )
 {
     assert(_p_intf);
 
-    if (windowFlags().testFlag(Qt::Window))
+    if (isWindow())
     {
         // If window, set the transient parent:
         QVLCDialog::setWindowTransientParent(this, nullptr, p_intf);
@@ -235,8 +235,14 @@ void QVLCDialog::keyPressEvent(QKeyEvent *keyEvent)
 
 void QVLCDialog::setWindowTransientParent(QWidget* widget, QWindow* parent, qt_intf_t* p_intf)
 {
-    if (!parent && p_intf)
+    assert(widget);
+    assert(widget->isWindow()); // Do not call this method if widget is not a window.
+
+    if (!parent && p_intf && !p_intf->b_isDialogProvider)
+    {
+        assert(p_intf->p_compositor);
         parent = p_intf->p_compositor->interfaceMainWindow();
+    }
     if (!parent)
         return;
 



View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/7d73f1b6166bbd241a1ca2f1eb65d9ad9351dd01...4d920c8ff72cd9964a945f5b186cf098a7c1f28e

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/7d73f1b6166bbd241a1ca2f1eb65d9ad9351dd01...4d920c8ff72cd9964a945f5b186cf098a7c1f28e
You're receiving this email because of your account on code.videolan.org.


VideoLAN code repository instance


More information about the vlc-commits mailing list