If no callback is being registered for the specific event type, null_event_cb() is called, which increments the g_message_counter. However this counter is already incremented in the invoke_callback() that calls it. As a result g_message_counter is incremented twice.