Fix crash when X11 is not available for VST UIs
[ardour.git] / gtk2_ardour / linux_vst_gui_support.cc
index b25404b884cfb4f3ed8964157b95afa3a0c78a16..80ef0ec305e8cfc3cfc8363cd04837f83dca3e21 100644 (file)
@@ -316,7 +316,8 @@ dispatch_x_events (XEvent* event, VSTState* vstfx)
 any Xevents to all the UI callbacks plugins 'may' have registered on their
 windows, that is if they don't manage their own UIs **/
 
-void* gui_event_loop (void* ptr)
+static void*
+gui_event_loop (void* ptr)
 {
        VSTState* vstfx;
        int LXVST_sched_timer_interval = 40; //ms, 25fps
@@ -623,6 +624,11 @@ int vstfx_create_editor (VSTState* vstfx)
        int x_size = 1;
        int y_size = 1;
 
+       if (!LXVST_XDisplay) {
+               vstfx_error ("** ERROR ** VSTFX: No X11 Display available for plugin UI");
+               return -1;
+       }
+
        /* Note: vstfx->lock is held while this function is called */
 
        if (!(vstfx->plugin->flags & effFlagsHasEditor))