Skip to content

Commit

Permalink
Fixes crashes on some plugins upon unloadPlugin(). Nulls out effect->…
Browse files Browse the repository at this point in the history
…resvd1. Apparently some plugins are checking this pointer and trying to free it themselves if it is not null.
  • Loading branch information
U-MARTIN-29BA21DE\Martin authored and U-MARTIN-29BA21DE\Martin committed Jan 20, 2009
1 parent dfd6f07 commit aba9183
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
Binary file modified jvsthost2.dll
Binary file not shown.
5 changes: 3 additions & 2 deletions src/com/synthbot/audioplugin/vst/vst2/JVstHost.cpp
Expand Up @@ -788,7 +788,6 @@ JNIEXPORT void JNICALL Java_com_synthbot_audioplugin_vst_vst2_JVstHost2_unloadPl
(JNIEnv *env, jclass jclazz, jlong ae) {

if (ae != 0) {

AEffect *effect = (AEffect *)ae;

if (isHostLocalVarsValid(effect)) {
Expand All @@ -801,10 +800,12 @@ JNIEXPORT void JNICALL Java_com_synthbot_audioplugin_vst_vst2_JVstHost2_unloadPl
if (hostVars->vti != 0) {
free(hostVars->vti);
}
free(hostVars);
effect->resvd1 = NULL;

// close the plugin
effect->dispatcher (effect, effClose, 0, 0, 0, 0);

// close the library from which the plugin was loaded
if (libPtr != 0) {
#if _WIN32
Expand Down
5 changes: 5 additions & 0 deletions src/com/synthbot/audioplugin/vst/vst2/JVstHost2.java
Expand Up @@ -134,6 +134,11 @@ protected synchronized void finalize() throws Throwable {
System.loadLibrary("jvsthost2");
}

@Override
public String toString() {
return getEffectName() + "@0x" + Long.toHexString(vstPluginPtr);
}

/**
* Indicates if the native component of the plugin is loaded. Any use of the
* JVstHost2 object while the plugin is not loaded will throw an <code>IllegalStateException</code>.
Expand Down

0 comments on commit aba9183

Please sign in to comment.