I have a few reservations about this approach. This situation is broadly covered by an email that Alexander Larsson wrote about how to cancel asynchronous GIO operations:
There is some good explanation there (and earlier in the thread) about this sort of occurrence which tends to support an approach of delaying finalization until all asynchronous operations owned by an object are finished.
Specifically, my concern with this approach is that the asynchronous completion callback will always be called, and therefore guarding access to the "self" pointer inside the callbacks is bogus. To put it another way, g_return_if_fail() is supposed to represent a programming error, and this change introduces an error in the case of going back to All Settings in System Settings. :-)
I think this is a neat approach for solving (1) in your description, but I do not think it is appropriate for solving (2). There, I think that my approach of delaying dispose/finalize is a better option.
I have a few reservations about this approach. This situation is broadly covered by an email that Alexander Larsson wrote about how to cancel asynchronous GIO operations:
https:/ /mail.gnome. org/archives/ gtk-devel- list/2010- April/msg00116. html
There is some good explanation there (and earlier in the thread) about this sort of occurrence which tends to support an approach of delaying finalization until all asynchronous operations owned by an object are finished.
Specifically, my concern with this approach is that the asynchronous completion callback will always be called, and therefore guarding access to the "self" pointer inside the callbacks is bogus. To put it another way, g_return_if_fail() is supposed to represent a programming error, and this change introduces an error in the case of going back to All Settings in System Settings. :-)
I think this is a neat approach for solving (1) in your description, but I do not think it is appropriate for solving (2). There, I think that my approach of delaying dispose/finalize is a better option.