Recommend auditing all use of g_signal_connect()
I spent most of yesterday and today looking over a bunch of gnome-calendar crash reports. One commonality is that there are several very similar mistakes with signal use:
- Failure to disconnect a signal handler from an object foo when the self object is destroyed. The foo outlives self and emits the signal, then the signal handler crashes because it's not prepared for self to already be destroyed. The best way to avoid this problem is to use g_signal_connect_object() (possibly with G_CONNECT_SWAPPED if desired), but disconnecting manually in dispose works fine too.
- Failure to disconnect the signal handler from a priv member when overwriting the priv member with another object. The signal handers must be disconnected manually.
Often both of these errors occur at the same time. Both errors are present in !73 (closed), !74 (merged), !75 (merged), !77 (merged), and !80 (merged). Each of those merge requests is a good example of how to fix both of these problems.
I have not audited gnome-calendar's code to check for more of these mistakes: I've just been looking at actual crash reports that have been piling up on Red Hat Bugzilla. I recommend reviewing every use of g_signal_connect* in gnome-calendar, as this seems highly likely to reveal more similar crashers. A quick count with 'git grep' reveals there about 90 of these to audit.