[vlc-commits] [Git][videolan/vlc][master] qt: fix memory leak in NetworkDeviceModel

Jean-Baptiste Kempf (@jbk) gitlab at videolan.org
Sun May 5 21:30:39 UTC 2024



Jean-Baptiste Kempf pushed to branch master at VideoLAN / VLC


Commits:
259c50c2 by Prince Gupta at 2024-05-05T21:03:30+00:00
qt: fix memory leak in NetworkDeviceModel

*GetMediaSource returns a strong reference which must be
released by vlc_media_source_Release (see vlc_media_source_provider_GetMediaSource),
store the returned referenced in appropriate RAII handler so
it can be automatically removed at the end of scope

- - - - -


1 changed file:

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


Changes:

=====================================
modules/gui/qt/network/networkdevicemodel.cpp
=====================================
@@ -220,8 +220,10 @@ public:
             q->m_name += q->m_name.isEmpty() ? qfu( meta->longname ) : ", " + qfu( meta->longname );
             emit q->nameChanged();
 
-            auto mediaSource = vlc_media_source_provider_GetMediaSource( provider,
-                                                                        meta->name );
+            MediaSourcePtr mediaSource(
+                        vlc_media_source_provider_GetMediaSource(provider, meta->name)
+                        , false );
+
             if ( mediaSource == nullptr )
                 continue;
             std::unique_ptr<MediaTreeListener> l{ new MediaTreeListener(



View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/259c50c2bdb6a27c8d3319832f155fd2d3e448cb

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