mirror of
https://github.com/obsproject/obs-studio.git
synced 2026-08-28 17:42:28 +08:00
obs-vst: Fix crash on macOS when no VST bundle was loaded
When loading a function from the bundle fails, the binary is unloaded and the reference is released, but the pointer itself is not reset - thus the check in the unload function will succeed and try to unload an invalid bundle reference. Similar to Linux and Windows, the pointer needs to be explicitly set to a null pointer to ensure this check fails.
This commit is contained in:
@@ -58,16 +58,16 @@ AEffect *VSTPlugin::loadEffect()
|
||||
|
||||
if (mainEntryPoint == NULL) {
|
||||
blog(LOG_WARNING, "Couldn't get a pointer to plug-in's main()");
|
||||
CFBundleUnloadExecutable(bundle);
|
||||
CFRelease(bundle);
|
||||
bundle = NULL;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
newEffect = mainEntryPoint(hostCallback_static);
|
||||
if (newEffect == NULL) {
|
||||
blog(LOG_WARNING, "VST Plug-in's main() returns null.");
|
||||
CFBundleUnloadExecutable(bundle);
|
||||
CFRelease(bundle);
|
||||
bundle = NULL;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -83,7 +83,7 @@ AEffect *VSTPlugin::loadEffect()
|
||||
void VSTPlugin::unloadLibrary()
|
||||
{
|
||||
if (bundle) {
|
||||
CFBundleUnloadExecutable(bundle);
|
||||
CFRelease(bundle);
|
||||
bundle = NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user