summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--plugingui/plugingui.cc10
-rw-r--r--plugingui/plugingui.h1
2 files changed, 11 insertions, 0 deletions
diff --git a/plugingui/plugingui.cc b/plugingui/plugingui.cc
index f345660..5408334 100644
--- a/plugingui/plugingui.cc
+++ b/plugingui/plugingui.cc
@@ -171,6 +171,8 @@ void closeClick(void *ptr)
PluginGUI::PluginGUI()
: MessageReceiver(MSGRCV_UI), sem("plugingui")
{
+ initialised = false;
+
windowClosedHandler = NULL;
changeMidimapHandler = NULL;
@@ -464,10 +466,14 @@ void PluginGUI::init()
window->show();
sem.post();
+
+ initialised = true;
}
void PluginGUI::show()
{
+ while(!initialised) usleep(10000);
+
if(!window) init();
window->show();
@@ -475,11 +481,15 @@ void PluginGUI::show()
void PluginGUI::hide()
{
+ while(!initialised) usleep(10000);
+
if(window) window->hide();
}
void PluginGUI::processEvents()
{
+ if(!initialised) return;
+
if(closing) {
if(windowClosedHandler) windowClosedHandler(windowClosedPtr);
closing = false;
diff --git a/plugingui/plugingui.h b/plugingui/plugingui.h
index f94a062..39643e1 100644
--- a/plugingui/plugingui.h
+++ b/plugingui/plugingui.h
@@ -92,6 +92,7 @@ public:
private:
volatile bool running;
volatile bool closing;
+ volatile bool initialised;
Semaphore sem;
};