messageTray: Only destroy policy after emitting ::destroy

Destroying the policy invalidates it, so accessing it from a
Source::destroy handler (for example to disconnect signal
handlers) currently results in warnings like:

Object .Gjs_ui_messageTray_NotificationApplicationPolicy
(0x7f8c7c0a64a0), has been already deallocated — impossible
to access it.

https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/2238
This commit is contained in:
Florian Müllner 2020-03-25 23:49:58 +01:00 committed by Georges Basile Stavracas Neto
parent c89d6a633a
commit 279072795f

View File

@ -880,8 +880,6 @@ var Source = GObject.registerClass({
}
destroy(reason) {
this.policy.destroy();
let notifications = this.notifications;
this.notifications = [];
@ -890,6 +888,7 @@ var Source = GObject.registerClass({
this.emit('destroy', reason);
this.policy.destroy();
this.run_dispose();
}