Skip to content
  • Georges Basile Stavracas Neto's avatar
    object: Add GObject properties to the correct prototype · f6758a3c
    Georges Basile Stavracas Neto authored
    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
    f6758a3c