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) {
>       g_main_loop_unref(my_state->mainloop);
>       my_state->mainloop = NULL;
> }
> 
> if (my_state->ctx) {
>       g_main_context_unref(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.

Philip
_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

Reply via email to