That's great! Thanks! Yeah, I'll keep it on my mind. I currently choose to 
depend on GLib 2.58 to do something like:
G_SOURCE_FUNC(agh_ubus_logstream_channel_io), lctx, NULL);

so there should be no issues in case.

Thank again!!

On Mon, 18 Mar 2019, Philip Withnall wrote:

Date: Mon, 18 Mar 2019 14:51:25
From: Philip Withnall <>
To: Enrico Mioso <>
Subject: Re: Correct way to deallocate an unix signal source

On Mon, 2019-03-18 at 14:38 +0100, Enrico Mioso wrote:
Regarding the code, at exit I do the following:
if (my_state->mainloop) {
        my_state->mainloop = NULL;

if (my_state->ctx) {
        my_state->ctx = NULL;

That looks fine. If you depend on GLib ≥ 2.34, you can instead do:

g_clear_pointer (&my_state->mainloop, g_main_loop_unref);
g_clear_pointer (&my_state->ctx, g_main_context_unref);

which is equivalent, but simplifies things a bit.


gtk-app-devel-list mailing list

Reply via email to