summaryrefslogtreecommitdiff
path: root/plugingui
diff options
context:
space:
mode:
authorBent Bisballe Nyeng <deva@aasimon.org>2014-10-16 19:14:00 +0200
committerBent Bisballe Nyeng <deva@aasimon.org>2014-10-16 19:14:00 +0200
commitb49dd62df721b2d965c995e69340b085d3489bf6 (patch)
treea5efb61686243dfa72c0c56c3007c8d874e729dd /plugingui
parent6b1a30cc3d5e00bd210b27344fceb1c863b23ed6 (diff)
Quick and dirty fix for LV2 UI crash.
Diffstat (limited to 'plugingui')
-rw-r--r--plugingui/plugingui.cc22
-rw-r--r--plugingui/plugingui.h2
2 files changed, 23 insertions, 1 deletions
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;
};