ocarina: Don't lock gdk when doing an idle_add call

idle_add needs the gdk lock, so it can't already be held when entering.

Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
This commit is contained in:
Bryan Schumaker 2012-01-23 20:14:54 -05:00
parent 1daa12ee81
commit a0b7718ee7
1 changed files with 17 additions and 4 deletions

View File

@ -9,11 +9,24 @@
#include <ocarina/settings.h>
#include <ocarina/footer.h>
void cb_handler(callback_t type)
static void conditional_lock(callback_t type)
{
if (type == IDLE_TASK_QUEUED)
return;
gdk_threads_enter();
}
static void conditional_unlock(callback_t type)
{
if (type == IDLE_TASK_QUEUED)
return;
gdk_threads_leave();
}
static void cb_handler(callback_t type)
{
libsaria::Track *current;
gdk_threads_enter();
conditional_lock(type);
switch (type) {
case PLAY:
@ -46,7 +59,7 @@ void cb_handler(callback_t type)
break;
}
gdk_threads_leave();
conditional_unlock(type);
}
void setup_callbacks()