[Webkit-unassigned] [Bug 87701] [Qt] REGRESSION(r118616): It made all tests crash in debug mode

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Tue May 29 11:02:54 PDT 2012


https://bugs.webkit.org/show_bug.cgi?id=87701





--- Comment #4 from Geoffrey Garen <ggaren at apple.com>  2012-05-29 11:02:54 PST ---
Here's a rough cut at the changes needed:

> void QtInstance::removeCachedMethod(JSObject* method)

*it will be NULL at finalization time. To maintain current behavior, I guess you could just check for NULL instead of == method. Any item that is null is garbage and can be safely removed from the table.

It would be event better to avoid O(n) search here by removing by key. To do that, use the weakRemove helper function.

>    JSObject* val = qtinst->m_methods.value(name).get();

HashMap will automatically return NULL for dead Weak pointers, so no change needed here.

>             qtinst->m_methods.insert(name, WriteBarrier<JSObject>(exec->globalData(), qtinst->createRuntimeObject(exec), val));

You want HashMap::set here, to guarantee an overwrite of a NULL Weak pointer.

>             qtinst->m_methods.insert(name, WriteBarrier<JSObject>(exec->globalData(), qtinst->createRuntimeObject(exec), val));

Ditto.

>     if (qtinst->m_methods.contains(ascii))

This should be HashMap::get. contains is wrong because it will return true even if the contained item is NULL.

>     // clean up (unprotect from gc) the JSValues we've created
>    m_methods.clear();

This can go away, since it's automatic for HashMap.


>    for (QHash<QByteArray, WriteBarrier<JSObject> >::Iterator it = m_methods.begin(), end = m_methods.end(); it != end; ++it)
>        visitor.append(&it.value());

Iterating a HashMap of Weak pointers you need to test the iterator for NULL before dereferencing it.

Not sure what Kind of PassWeak errors you got. I might be able to help you if you paste them.

-- 
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.



More information about the webkit-unassigned mailing list