GNOME Bugzilla – Bug 768790
Impossible to inherit from class with composite template
Last modified: 2018-01-27 12:00:44 UTC
Created attachment 331453 [details] Minimal script to illustrate the problem It's not possible to inherit from a class that uses a composite template, because gtk_widget_template_init() is called in the subclass's instance init rather than the parent's. That's not a very clear explanation, so see attached script that illustrates the problem. I am at a loss as to how to fix this. It seems that the code currently assumes that only one JS _instance_init() function is to be called per object construction and that it should be called from the most derived class's GObject instance init. As per the documentation of gtk_widget_init_template(), "This function must be called in the instance initializer for any class which assigned itself a template using gtk_widget_class_set_template()", which I interpret to mean that init_template() should be called from the superclass's GObject instance init. This might mean that we have to move template initialization to C.
Created attachment 331454 [details] [review] WIP - Test case
The patch is an automated test case, to build a fix on top of.
Comment on attachment 331454 [details] [review] WIP - Test case Setting status to remove from unreviewed patches list. This patch will need refactoring anyway to work with Jasmine.
Comment on attachment 331454 [details] [review] WIP - Test case I'm putting a rebased version of this test, marked pending, on my next maintenance merge request.
-- GitLab Migration Automatic Message -- This bug has been migrated to GNOME's GitLab instance and has been closed from further activity. You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.gnome.org/GNOME/gjs/issues/97.