Skip to content

object: Add GObject properties to the correct prototype

Georges Basile Stavracas Neto requested to merge gbsneto/issue-171 into master

Whenever successfully resolving a property, GJS is mistakenly setting the property in the prototype of the prototype, instead of just the prototype. When that happens, it ends up breaking any properties of subclasses. Suppose the following scenario:

     GObject
        |________________
        |                |
 GCharsetConverter   Subclass2
        |
    Subclass1

In this scenario, if 'Subclass1' accesses any possible property from GCharsetConverter, GJS resolves that but ends up setting this property in the prototype of the prototype.

If 'Subclass2' then tries to subsequently access that property, the resolving process will accidentally call the wrong getter. This leads to an immediate crash.

Fix that by using the correct object prototype when resolving the properties. A reproducer was added to the test suite in addition to the fix to this problem, as a protective measure.

Fixes #171 (closed)

Edited by Georges Basile Stavracas Neto

Merge request reports