[vlc-commits] [Git][videolan/vlc][master] qt: fix use after free in first run wizard

Steve Lhomme (@robUx4) gitlab at videolan.org
Sat Oct 19 05:48:23 UTC 2024



Steve Lhomme pushed to branch master at VideoLAN / VLC


Commits:
81fbc423 by Pierre Lamot at 2024-10-19T05:34:31+00:00
qt: fix use after free in first run wizard

* when MainCtx is destroyed, the medialibrary is destroyed
* dialogs provider was destroyed after the MainCtx, the dialog provider provides
  the FirstRun dialog
* FirstRun dialog uses a model from the medialibrary

- - - - -


1 changed file:

- modules/gui/qt/qt.cpp


Changes:

=====================================
modules/gui/qt/qt.cpp
=====================================
@@ -1115,22 +1115,9 @@ static void *ThreadCleanup( qt_intf_t *p_intf, CleanupReason cleanupReason )
     if ( p_intf->p_compositor )
     {
         if (cleanupReason == CLEANUP_INTF_CLOSED)
-        {
             p_intf->p_compositor->unloadGUI();
-            delete p_intf->p_mi;
-            p_intf->p_mi = nullptr;
-        }
         else // CLEANUP_APP_TERMINATED
-        {
             p_intf->p_compositor->destroyMainInterface();
-            delete p_intf->p_mi;
-            p_intf->p_mi = nullptr;
-
-            delete p_intf->mainSettings;
-            p_intf->mainSettings = nullptr;
-
-            p_intf->p_compositor.reset();
-        }
     }
 
     /* */
@@ -1143,10 +1130,22 @@ static void *ThreadCleanup( qt_intf_t *p_intf, CleanupReason cleanupReason )
        Settings must be destroyed after that.
      */
     DialogsProvider::killInstance();
-
     VLCDialogModel::killInstance();
     DialogErrorModel::killInstance();
 
+    if ( p_intf->p_compositor &&  cleanupReason == CLEANUP_APP_TERMINATED)
+    {
+        p_intf->p_compositor.reset();
+
+        //destroy MainCtx
+        delete p_intf->p_mi;
+        p_intf->p_mi = nullptr;
+
+        delete p_intf->mainSettings;
+        p_intf->mainSettings = nullptr;
+
+    }
+
     /* Destroy the main playlist controller */
     if (p_intf->p_mainPlaylistController)
     {



View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/81fbc423b40a0053ff943e832bf6bac2934ba898

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/81fbc423b40a0053ff943e832bf6bac2934ba898
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