Calling implemented methods or getters on disposed objects returns function pointers
Using a simple test such as:
imports.gi.versions.Gtk = '3.0';
const { Gtk } = imports.gi;
Gtk.init(null);
const label = new Gtk.Label();
label.destroy()
print(label.label);
print(label.connect('fooo', () => {}));
print(label.connect_after('fooo', () => {}));
print(label.emit('notify'));
print(GObject.signal_handlers_block_by_func(label, () => {}));
print(GObject.signal_handlers_unblock_by_func(label, () => {}));
print(GObject.signal_handlers_disconnect_by_func(label, () => {}));
We get:
(gjs:371596): Gjs-CRITICAL **: 17:48:16.099: Object .Gjs_OtherBadLabel (0x5579419df8b0), has been already deallocated — impossible to get any property from it. This might be caused by the object having been destroyed from C code using something such as destroy(), dispose(), or remove() vfuncs.
== Stack trace for context 0x5579419521c0 ==
#0 5579419fc140 i /tmp/gtktest.js:23 (26c38cf8cec0 @ 340)
function gobject_prop_get::label() {
[native code]
}
(gjs:371596): Gjs-CRITICAL **: 17:48:16.099: Object .Gjs_OtherBadLabel (0x5579419df8b0), has been already deallocated — impossible to connect to any signal on it. This might be caused by the object having been destroyed from C code using something such as destroy(), dispose(), or remove() vfuncs.
== Stack trace for context 0x5579419521c0 ==
#0 5579419fc140 i /tmp/gtktest.js:24 (26c38cf8cec0 @ 382)
function connect() {
[native code]
}
(gjs:371596): Gjs-CRITICAL **: 17:48:16.099: Object .Gjs_OtherBadLabel (0x5579419df8b0), has been already deallocated — impossible to connect to any signal on it. This might be caused by the object having been destroyed from C code using something such as destroy(), dispose(), or remove() vfuncs.
== Stack trace for context 0x5579419521c0 ==
#0 5579419fc140 i /tmp/gtktest.js:25 (26c38cf8cec0 @ 422)
function connect_after() {
[native code]
}
(gjs:371596): Gjs-CRITICAL **: 17:48:16.100: Object .Gjs_OtherBadLabel (0x5579419df8b0), has been already deallocated — impossible to emit any signal on it. This might be caused by the object having been destroyed from C code using something such as destroy(), dispose(), or remove() vfuncs.
== Stack trace for context 0x5579419521c0 ==
#0 5579419fc140 i /tmp/gtktest.js:26 (26c38cf8cec0 @ 456)
function emit() {
[native code]
}
(gjs:372989): Gjs-CRITICAL **: 18:00:00.307: Object Gtk.Label (0x557a468eb8b0), has been already deallocated — impossible to block any signal on it. This might be caused by the object having been destroyed from C code using something such as destroy(), dispose(), or remove() vfuncs.
== Stack trace for context 0x557a4685e1c0 ==
#0 557a46908290 i resource:///org/gnome/gjs/modules/core/overrides/GObject.js:721 (10f33c5aed80 @ 29)
#1 557a469081e0 i /tmp/gtktest.js:28 (10f33c58cfb0 @ 535)
function [__GObject__signals_block]() {
[native code]
}
(gjs:372989): Gjs-CRITICAL **: 18:00:00.307: Object Gtk.Label (0x557a468eb8b0), has been already deallocated — impossible to unblock any signal on it. This might be caused by the object having been destroyed from C code using something such as destroy(), dispose(), or remove() vfuncs.
== Stack trace for context 0x557a4685e1c0 ==
#0 557a46908290 i resource:///org/gnome/gjs/modules/core/overrides/GObject.js:732 (10f33c5aed30 @ 29)
#1 557a469081e0 i /tmp/gtktest.js:29 (10f33c58cfb0 @ 575)
function [__GObject__signals_unblock]() {
[native code]
}
(gjs:372989): Gjs-CRITICAL **: 18:00:00.308: Object Gtk.Label (0x557a468eb8b0), has been already deallocated — impossible to disconnect any signal on it. This might be caused by the object having been destroyed from C code using something such as destroy(), dispose(), or remove() vfuncs.
== Stack trace for context 0x557a4685e1c0 ==
#0 557a46908290 i resource:///org/gnome/gjs/modules/core/overrides/GObject.js:743 (10f33c5aece0 @ 29)
#1 557a469081e0 i /tmp/gtktest.js:30 (10f33c58cfb0 @ 615)
function [__GObject__signals_disconnect]() {
[native code]
}
Edited by Marco Trevisan