-
Debarshi Ray authored
There are two scenarios. A widget sub-class owns a GtkEventController and passes itself to it, or a controller owned by something else is passed a widget. In the second case, if the widget is destroyed before the controller, we will have a crash when destructing the controller because we will be accessing invalid memory. Adding a weak reference on the widget addresses that problem. This leads to a crash in the first case. When the widget is getting destroyed, it will drop the reference to its own controller. The controller will skip touching the widget because the weak reference would have turned it to NULL. However, when the widget sub-class chains up to GtkWidget it will try to free all the controllers in its list. Unfortunately, all these controllers have already been destroyed. So we need to guard against this too. https://bugzilla.gnome.org/show_bug.cgi?id=745225
7c4bf742