[vlc-commits] macosx: Fix crash when deinitializing PLModel
David Fuhrmann
git at videolan.org
Tue Aug 11 20:18:13 CEST 2015
vlc | branch: master | David Fuhrmann <dfuhrmann at videolan.org> | Tue Aug 11 19:14:59 2015 +0200| [3d3878d3c5699b92667144b3a60584a58255e8e0] | committer: David Fuhrmann
macosx: Fix crash when deinitializing PLModel
Only self should be used as callback parameters. Otherwise,
depending on the destruction order the original object might be
deinitialized already.
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=3d3878d3c5699b92667144b3a60584a58255e8e0
---
modules/gui/macosx/PLModel.m | 11 +++++------
1 file changed, 5 insertions(+), 6 deletions(-)
diff --git a/modules/gui/macosx/PLModel.m b/modules/gui/macosx/PLModel.m
index 1497c1d..7478fc3 100644
--- a/modules/gui/macosx/PLModel.m
+++ b/modules/gui/macosx/PLModel.m
@@ -93,8 +93,7 @@ static int VolumeUpdated(vlc_object_t *p_this, const char *psz_var,
{
@autoreleasepool {
dispatch_async(dispatch_get_main_queue(), ^{
- VLCMainWindow *mainWindow = (__bridge VLCMainWindow*)param;
- [mainWindow updateVolumeSlider];
+ [[[VLCMain sharedInstance] mainWindow] updateVolumeSlider];
});
return VLC_SUCCESS;
@@ -133,8 +132,8 @@ static int VolumeUpdated(vlc_object_t *p_this, const char *psz_var,
var_AddCallback(p_playlist, "random", PlaybackModeUpdated, (__bridge void *)self);
var_AddCallback(p_playlist, "repeat", PlaybackModeUpdated, (__bridge void *)self);
var_AddCallback(p_playlist, "loop", PlaybackModeUpdated, (__bridge void *)self);
- var_AddCallback(p_playlist, "volume", VolumeUpdated, (__bridge void *)[[VLCMain sharedInstance] mainWindow]);
- var_AddCallback(p_playlist, "mute", VolumeUpdated, (__bridge void *)[[VLCMain sharedInstance] mainWindow]);
+ var_AddCallback(p_playlist, "volume", VolumeUpdated, (__bridge void *)self);
+ var_AddCallback(p_playlist, "mute", VolumeUpdated, (__bridge void *)self);
PL_LOCK;
_rootItem = [[PLItem alloc] initWithPlaylistItem:root];
@@ -153,8 +152,8 @@ static int VolumeUpdated(vlc_object_t *p_this, const char *psz_var,
var_DelCallback(p_playlist, "random", PlaybackModeUpdated, (__bridge void *)self);
var_DelCallback(p_playlist, "repeat", PlaybackModeUpdated, (__bridge void *)self);
var_DelCallback(p_playlist, "loop", PlaybackModeUpdated, (__bridge void *)self);
- var_DelCallback(p_playlist, "volume", VolumeUpdated, (__bridge void *)[[VLCMain sharedInstance] mainWindow]);
- var_DelCallback(p_playlist, "mute", VolumeUpdated, (__bridge void *)[[VLCMain sharedInstance] mainWindow]);
+ var_DelCallback(p_playlist, "volume", VolumeUpdated, (__bridge void *)self);
+ var_DelCallback(p_playlist, "mute", VolumeUpdated, (__bridge void *)self);
}
- (void)changeRootItem:(playlist_item_t *)p_root;
More information about the vlc-commits
mailing list