From b49dd62df721b2d965c995e69340b085d3489bf6 Mon Sep 17 00:00:00 2001 From: Bent Bisballe Nyeng Date: Thu, 16 Oct 2014 19:14:00 +0200 Subject: Quick and dirty fix for LV2 UI crash. --- plugingui/plugingui.cc | 22 ++++++++++++++++++++++ plugingui/plugingui.h | 2 +- 2 files changed, 23 insertions(+), 1 deletion(-) (limited to 'plugingui') diff --git a/plugingui/plugingui.cc b/plugingui/plugingui.cc index f345660..4a2f4fa 100644 --- a/plugingui/plugingui.cc +++ b/plugingui/plugingui.cc @@ -171,6 +171,9 @@ void closeClick(void *ptr) PluginGUI::PluginGUI() : MessageReceiver(MSGRCV_UI), sem("plugingui") { + initialised = false; + //printf("PluginGUI::PluginGUI() begin\n"); fflush(stdout); + windowClosedHandler = NULL; changeMidimapHandler = NULL; @@ -186,6 +189,8 @@ PluginGUI::PluginGUI() #endif/*USE_THREAD*/ sem.wait(); + + //printf("PluginGUI::PluginGUI() done\n"); fflush(stdout); } PluginGUI::~PluginGUI() @@ -301,6 +306,8 @@ void PluginGUI::init() { DEBUG(gui, "init"); + //printf("init begin\n"); fflush(stdout); + config = new Config(); config->load(); @@ -464,10 +471,17 @@ void PluginGUI::init() window->show(); sem.post(); + + //printf("init end\n"); fflush(stdout); + initialised = true; } void PluginGUI::show() { + while(!initialised) { + //printf("Waiting for init to finish\n"); fflush(stdout); + sleep(1); + } if(!window) init(); window->show(); @@ -475,11 +489,19 @@ void PluginGUI::show() void PluginGUI::hide() { + while(!initialised) { + //printf("Waiting for init to finish\n"); fflush(stdout); + sleep(1); + } if(window) window->hide(); } void PluginGUI::processEvents() { + if(!initialised) { + //printf("Not yet initialised\n"); fflush(stdout); + return; + } if(closing) { if(windowClosedHandler) windowClosedHandler(windowClosedPtr); closing = false; diff --git a/plugingui/plugingui.h b/plugingui/plugingui.h index f94a062..36e8b1c 100644 --- a/plugingui/plugingui.h +++ b/plugingui/plugingui.h @@ -92,7 +92,7 @@ public: private: volatile bool running; volatile bool closing; - + volatile bool initialised; Semaphore sem; }; -- cgit v1.2.3