glib 2.34 g_main_context_unref hangs

I'm trying to figure out if this is a glib bug or not. I just upgraded to 2.34 from 2.32 and my applications now hangs on exit. (This is existing code that has worked fine since 2.22)

I have a sig handler to intercept Ctrl-C which calls main_loop_quit() which appears to all work.

I create my main_loop as follows:

static GMainContext *default_main_context;

  if (!default_main_context)
    // For main thread
    ch->main_context  = g_main_context_default ();
    default_main_context = ch->main_context;
} else
    // If running a thread, give it its own mainloop context.
    ch->main_context  = g_main_context_new();

    ch->main_loop = g_main_loop_new(ch->main_context, FALSE);

In my cleanup routine, called after main_loop exists, I have:

  main_loop = ch->main_loop;
  context = ch->main_context;

  if (main_loop)

  if (context)

Under 2.34.2, g_main_context_unref is hanging on the following line:

 g_source_destroy_internal (source, context, FALSE);
And in that function the hang is due to LOCK_CONTEXT(context)

Is this a 2.34 bug? I believe I have cleaned up everything and the g_main_context_unref(context) is pretty much the last glib thing done. Not sure
why it is hanging on anything.

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]