main loop reference count going to zero early

themanonthemoon adkyriazis at gmail.com
Wed Oct 10 20:14:48 UTC 2018


I am trying to have an event quit a loop asynchronously. Everytime the 'quit
loop' callback is triggered, an error is thrown that the reference count is
already 0.

Error:
g_main_loop_is_running: assertion 'g_atomic_int_get (&loop->ref_count) > 0'
failed

My code is the following:

//create loop
GMainLoop *loop;
loop = g_main_loop_new (NULL, FALSE);

//...some stuff

//create a quit loop callback
g_signal_new ("signalling-error", G_TYPE_OBJECT, G_SIGNAL_RUN_FIRST,0, NULL,
NULL, NULL, G_TYPE_NONE, 0);
g_signal_connect (pipeline, "signalling-error", G_CALLBACK (quit_loop),
loop);

//... some stuff

g_main_loop_run (loop);


And then here is the quit loop callback.

static void quit_loop(GMainLoop* loop) {
  g_assert_nonnull (loop);
  if (g_main_loop_is_running(loop)){
    g_main_loop_quit (loop);    
  }
}

Elsewhere I have code that emits the signalling-error signal. Why should
loop be already dereferenced in the callback? Is it something to do with how
signals work?





--
Sent from: http://gstreamer-devel.966125.n4.nabble.com/


More information about the gstreamer-devel mailing list