Skip to content
  • hausmann@webkit.org's avatar
    WebCore: · a20dc7d6
    hausmann@webkit.org authored
    2009-07-23  Simon Hausmann  <simon.hausmann@nokia.com>
    
            Reviewed by Holger Freyther.
    
            Fix crashes with the QObject bindings after garbage collection.
    
            There is one QtInstance per wrapped QObject, and that QtInstance keeps
            references to cached JSObjects for slots. When those objects get
            deleted due to GC, then they becoming dangling pointers.
    
            When a cached member dies, it is now removed from the QtInstance's
            cache.
    
            As we cannot track the lifetime of the children, we have to remove
            them from QtInstance alltogether. They are not cached and were
            only used for mark(), but we _want_ them to be subject to gc.
    
            * bridge/qt/qt_instance.cpp:
            (JSC::Bindings::QtInstance::~QtInstance): Minor coding style cleanup,
            use qDeleteAll().
            (JSC::Bindings::QtInstance::removeCachedMethod): New function, to
            clean m_methods and m_defaultMethod.
            (JSC::Bindings::QtInstance::mark): Avoid marking already marked objects.
            (JSC::Bindings::QtField::valueFromInstance): Don't save children for
            marking.
            * bridge/qt/qt_instance.h: Declare removeCachedMethod.
            * bridge/qt/qt_runtime.cpp:
            (JSC::Bindings::QtRuntimeMethod::~QtRuntimeMethod): Call removeCachedMethod
            with this on the instance.
    
    WebKit/qt:
    
    2009-07-23  Simon Hausmann  <simon.hausmann@nokia.com>
    
            Reviewed by Holger Freyther.
    
            Added a testcase to verify that cached methods in the QOBject bindings
            remain alife even after garbage collection.
    
            * tests/qwebpage/tst_qwebpage.cpp:
            (tst_QWebPage::protectBindingsRuntimeObjectsFromCollector):
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@46265 268f45cc-cd09-0410-ab3c-d52691b4dbfc
    a20dc7d6