summaryrefslogtreecommitdiff
path: root/plugingui/plugingui.cc
diff options
context:
space:
mode:
authorBent Bisballe Nyeng <deva@aasimon.org>2014-10-17 11:22:14 +0200
committerBent Bisballe Nyeng <deva@aasimon.org>2014-10-17 11:22:14 +0200
commit29ec8552826f64bfa8cad01a433306886328c522 (patch)
tree6ff7c8c958001c23b1ad25920bddb9494410119b /plugingui/plugingui.cc
parentc7af1c332447e5fb25f37d4738458a5d7106a6fc (diff)
Fix GUI crash when running in thread mode and init wasn't done when show was called.
Diffstat (limited to 'plugingui/plugingui.cc')
-rw-r--r--plugingui/plugingui.cc10
1 files changed, 10 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;