[gjs: 2/3] tests/Gtk3: Functions that leads running dispose vfuncs can be safely called




commit ffac59100c24ac180065e145b7d04c6af5daf927
Author: Marco Trevisan (TreviƱo) <mail 3v1n0 net>
Date:   Sat Mar 13 06:49:04 2021 +0100

    tests/Gtk3: Functions that leads running dispose vfuncs can be safely called
    
    This wasn't the case before previous commit, but it's actually safe to
    do, so gjs should not warn about.

 installed-tests/js/testGtk3.js | 15 +++++++++++++++
 1 file changed, 15 insertions(+)
---
diff --git a/installed-tests/js/testGtk3.js b/installed-tests/js/testGtk3.js
index 15187b67..fd0608d1 100644
--- a/installed-tests/js/testGtk3.js
+++ b/installed-tests/js/testGtk3.js
@@ -191,6 +191,21 @@ describe('Gtk overrides', function () {
             'Gtk overrides avoid crashing and print a stack trace');
     });
 
+    it('GTK vfuncs can be explicitly called during disposition', function () {
+        let called;
+        const GoodLabel = GObject.registerClass(class GoodLabel extends Gtk.Label {
+            vfunc_destroy() {
+                called = true;
+            }
+        });
+
+        let label = new GoodLabel();
+        label.destroy();
+        expect(called).toBeTruthy();
+        label = null;
+        System.gc();
+    });
+
     it('accepts string in place of GdkAtom', function () {
         expect(() => Gtk.Clipboard.get(1)).toThrow();
         expect(() => Gtk.Clipboard.get(true)).toThrow();


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]