After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 768790 - Impossible to inherit from class with composite template
Impossible to inherit from class with composite template
Status: RESOLVED OBSOLETE
Product: gjs
Classification: Bindings
Component: general
1.45.x
Other Linux
: Normal normal
: ---
Assigned To: gjs-maint
gjs-maint
Depends on:
Blocks:
 
 
Reported: 2016-07-14 00:43 UTC by Philip Chimento
Modified: 2018-01-27 12:00 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Minimal script to illustrate the problem (1.78 KB, application/javascript)
2016-07-14 00:43 UTC, Philip Chimento
  Details
WIP - Test case (938 bytes, patch)
2016-07-14 00:45 UTC, Philip Chimento
rejected Details | Review

Description Philip Chimento 2016-07-14 00:43:55 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.
Comment 1 Philip Chimento 2016-07-14 00:45:58 UTC
Created attachment 331454 [details] [review]
WIP - Test case
Comment 2 Philip Chimento 2016-07-14 00:47:01 UTC
The patch is an automated test case, to build a fix on top of.
Comment 3 Philip Chimento 2017-02-27 04:37:54 UTC
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 4 Philip Chimento 2018-01-21 06:53:39 UTC
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.
Comment 5 GNOME Infrastructure Team 2018-01-27 12:00:44 UTC
-- 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.