[vlc-commits] macosx/menu: remove last occurence of vlc_object_release (closes #22204)

Felix Paul Kühne git at videolan.org
Mon Apr 29 19:27:04 CEST 2019


vlc | branch: master | Felix Paul Kühne <felix at feepk.net> | Sun Apr 28 11:41:09 2019 +0200| [87bd714c4975daa02a0b6f1ad5e0318f213a5cfe] | committer: Felix Paul Kühne

macosx/menu: remove last occurence of vlc_object_release (closes #22204)

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=87bd714c4975daa02a0b6f1ad5e0318f213a5cfe
---

 modules/gui/macosx/menus/VLCMainMenu.m | 22 ++++++++++++++++++----
 1 file changed, 18 insertions(+), 4 deletions(-)

diff --git a/modules/gui/macosx/menus/VLCMainMenu.m b/modules/gui/macosx/menus/VLCMainMenu.m
index 49ab9dc053..bd42cd433a 100644
--- a/modules/gui/macosx/menus/VLCMainMenu.m
+++ b/modules/gui/macosx/menus/VLCMainMenu.m
@@ -1902,8 +1902,9 @@ typedef NS_ENUM(NSInteger, VLCObjectType) {
         _variableName = strdup(name);
         _variableType = type;
         _variableValue = value;
-        if ((type & VLC_VAR_TYPE) == VLC_VAR_STRING)
+        if ((type & VLC_VAR_TYPE) == VLC_VAR_STRING) {
             _variableValue.psz_string = strdup(value.psz_string);
+        }
     }
 
     return(self);
@@ -1911,10 +1912,23 @@ typedef NS_ENUM(NSInteger, VLCObjectType) {
 
 - (void)dealloc
 {
-    if (_vlcObject && _objectType != VLCObjectTypeInterface)
-        vlc_object_release(_vlcObject);
-    if ((_variableType & VLC_VAR_TYPE) == VLC_VAR_STRING)
+    if (_vlcObject) {
+        switch (_objectType) {
+            case VLCObjectTypeAout:
+                aout_Release((audio_output_t *)_vlcObject);
+                break;
+            case VLCObjectTypeVout:
+                vout_Release((vout_thread_t *)_vlcObject);
+                break;
+
+            default:
+                // the interface will be released by the core shortly
+                break;
+        }
+    }
+    if ((_variableType & VLC_VAR_TYPE) == VLC_VAR_STRING) {
         free(_variableValue.psz_string);
+    }
     free(_variableName);
 }
 



More information about the vlc-commits mailing list