[vlc-commits] [Git][videolan/vlc][master] macosx: Prevent crash from null p_event on model callback
Marvin Scholz (@ePirat)
gitlab at videolan.org
Wed Mar 26 19:57:07 UTC 2025
Marvin Scholz pushed to branch master at VideoLAN / VLC
Commits:
4bb2f7d4 by Claudio Cambra at 2025-03-26T19:43:08+00:00
macosx: Prevent crash from null p_event on model callback
When accessing p_event in the model callback, it is possible for the p_event to
no longer be valid as the callback uses an async dispatch queue. By accessing
the properties of the p_event synchronously before entering the async block, we
can avoid this crash
Signed-off-by: Claudio Cambra <developer at claudiocambra.com>
- - - - -
1 changed file:
- modules/gui/macosx/library/VLCLibraryModel.m
Changes:
=====================================
modules/gui/macosx/library/VLCLibraryModel.m
=====================================
@@ -225,8 +225,9 @@ static void libraryCallback(void *p_data, const vlc_ml_event_t *p_event)
});
break;
case VLC_ML_EVENT_DISCOVERY_PROGRESS:
+ {
+ NSString * const entryPoint = toNSStr(p_event->discovery_progress.psz_entry_point);
dispatch_async(dispatch_get_main_queue(), ^{
- NSString * const entryPoint = toNSStr(p_event->discovery_progress.psz_entry_point);
NSDictionary<NSString *, NSString *> * const info = entryPoint == nil
? nil
: @{@"entryPoint": entryPoint};
@@ -236,6 +237,7 @@ static void libraryCallback(void *p_data, const vlc_ml_event_t *p_event)
userInfo:info];
});
break;
+ }
case VLC_ML_EVENT_DISCOVERY_COMPLETED:
dispatch_async(dispatch_get_main_queue(), ^{
NSNotificationCenter * const defaultCenter = NSNotificationCenter.defaultCenter;
View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/4bb2f7d4526e57fa19bf360cfa2052b2c07ce241
--
View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/4bb2f7d4526e57fa19bf360cfa2052b2c07ce241
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