[vlc-commits] [Git][videolan/vlc][master] qt: explicitly disconnect signals in NetworkDeviceModelPrivate destructor

Felix Paul Kühne (@fkuehne) gitlab at videolan.org
Sun Jan 5 16:46:24 UTC 2025



Felix Paul Kühne pushed to branch master at VideoLAN / VLC


Commits:
68e4fa42 by Pierre Lamot at 2025-01-05T16:23:23+00:00
qt: explicitly disconnect signals in NetworkDeviceModelPrivate destructor

We need to explicitly disconnect signals here:

- destructor will release m_sourcesProvider

- the shared MediaSourceModel will be released

- they will notify mediaRemoved, but the slot expects the shared
  MediaSourceModel to be valid

At this point we don't care about model updates

- - - - -


1 changed file:

- modules/gui/qt/network/networkdevicemodel.cpp


Changes:

=====================================
modules/gui/qt/network/networkdevicemodel.cpp
=====================================
@@ -209,6 +209,17 @@ public:
         : LocalListBaseModelPrivate<NetworkDeviceItemPtr>(pub)
     {}
 
+    ~NetworkDeviceModelPrivate()
+    {
+        //Explicilty disconnect signals here:
+        // - destructor will release m_sourcesProvider
+        // - its shared MediaSourceModel will be released
+        // - they will notify `mediaRemoved`, but the slot expects the shared MediaSourceModel to be valid
+        // at this point we don't care about model updates
+        for (auto& conn : m_sourceUpdateConnections)
+            QObject::disconnect(conn);
+    }
+
     NetworkDeviceModelLoader::ItemCompare getSortFunction() const override
     {
         if (m_sortCriteria == "mrl")



View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/68e4fa428f180022bcb58654671bd6ff6a36f2e3

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