+ if (fst->destroy) {
+ fprintf (stderr, "%s scheduled for destroy\n", fst->handle->name);
+ if (fst->window) {
+ fst->plugin->dispatcher( fst->plugin, effEditClose, 0, 0, NULL, 0.0 );
+ CloseWindow (fst->window);
+ fst->window = NULL;
+ fst->destroy = FALSE;
+ }
+ fst_event_loop_remove_plugin (fst);
+ fst->been_activated = FALSE;
+ pthread_cond_signal (&fst->window_status_change);
+ pthread_mutex_unlock (&fst->lock);
+ goto again;
+ }
+
+ if (fst->window == NULL) {
+ if (fst_create_editor (fst)) {
+ fst_error ("cannot create editor for plugin %s", fst->handle->name);
+ fst_event_loop_remove_plugin (fst);
+ pthread_cond_signal (&fst->window_status_change);
+ pthread_mutex_unlock (&fst->lock);
+ goto again;
+ } else {
+ /* condition/unlock: it was signalled & unlocked in fst_create_editor() */
+ }
+ }
+
+ if (fst->want_program != -1 ) {
+ if (fst->vst_version >= 2) {
+ fst->plugin->dispatcher (fst->plugin, 67 /* effBeginSetProgram */, 0, 0, NULL, 0);
+ }
+
+ fst->plugin->dispatcher (fst->plugin, effSetProgram, 0, fst->want_program, NULL, 0);
+
+ if (fst->vst_version >= 2) {
+ fst->plugin->dispatcher (fst->plugin, 68 /* effEndSetProgram */, 0, 0, NULL, 0);
+ }
+ /* did it work? */
+ fst->current_program = fst->plugin->dispatcher (fst->plugin, 3, /* effGetProgram */ 0, 0, NULL, 0);
+ fst->want_program = -1;
+ }
+
+ if(fst->dispatcher_wantcall) {
+ fst->dispatcher_retval = fst->plugin->dispatcher( fst->plugin,
+ fst->dispatcher_opcode,
+ fst->dispatcher_index,
+ fst->dispatcher_val,
+ fst->dispatcher_ptr,
+ fst->dispatcher_opt );
+ fst->dispatcher_wantcall = 0;
+ pthread_cond_signal (&fst->plugin_dispatcher_called);
+ }
+
+ fst->plugin->dispatcher (fst->plugin, effEditIdle, 0, 0, NULL, 0);
+
+ if( fst->wantIdle ) {
+ fst->plugin->dispatcher (fst->plugin, 53, 0, 0, NULL, 0);
+ }
+
+ pthread_mutex_unlock (&fst->lock);