SLL_Pop list is not checked for NULL
In JavaScriptCore/wtf/FastMalloc.cpp:696 The list should be checked for NULL. Eg. static inline void *SLL_Pop(void **list) { if (!list || !(*list)) return NULL; void *result = *list; *list = SLL_Next(*list); return result; } Greets, Luka
On Aug 3, 2009, at 5:00 AM, Luka Napotnik wrote:
In JavaScriptCore/wtf/FastMalloc.cpp:696
The list should be checked for NULL.
No, that’s incorrect. The code is fine as it is. There’s only one caller and that caller guarantees that neither list nor *list is 0. Is there some reason you think this change is necessary? -- Darin
Dne 03.08.2009 (pon) ob 09:51 -0700 je Darin Adler zapisal(a):
On Aug 3, 2009, at 5:00 AM, Luka Napotnik wrote:
In JavaScriptCore/wtf/FastMalloc.cpp:696
The list should be checked for NULL.
No, that’s incorrect. The code is fine as it is. There’s only one caller and that caller guarantees that neither list nor *list is 0. Is there some reason you think this change is necessary?
Oh didn't trace SLL_Pop() back to Pop() to see the ASSERT(). I was just walking the source and noticed.
-- Darin
Greets, Luka
I have added protected: AccessibilityRole m_role; to AccessibilityObject.h I want to initialize that variable in subclasses of AccessibilityObject, like so AccessibilityImageMapLink::AccessibilityImageMapLink() : m_role(WebCoreLinkRole) but the compiler says /Volumes/data/WebKit/WebCore/accessibility/ AccessibilityImageMapLink.cpp:48: error: class ‘WebCore::AccessibilityImageMapLink’ does not have any field named ‘m_role’ even though this works fine AccessibilityImageMapLink::AccessibilityImageMapLink() { m_role = WebCoreLinkRole; } any tips? thanx
Make your base class constructor take the role as an argument. Then the subclasses can just pass in the value they want to use to initialize it e.g., AccessibilityObject(AccessibilityRole role) : m_role(role) { } and then in the subclass AccessibilityImageMapLink() : AccessibilityObject(WebCoreLinkRole) { } Another option is to just forego the member variable storage and make a virtual function that returns the role. That only works if the role can be determined from the subclasses though. virtual AccessibilityRole role() const { return WebCoreLinkRole; } Hope this helps, dave (hyatt@apple.com) On Aug 3, 2009, at 5:51 PM, Chris Fleizach wrote:
I have added
protected: AccessibilityRole m_role;
to AccessibilityObject.h
I want to initialize that variable in subclasses of AccessibilityObject, like so
AccessibilityImageMapLink::AccessibilityImageMapLink() : m_role(WebCoreLinkRole)
but the compiler says
/Volumes/data/WebKit/WebCore/accessibility/ AccessibilityImageMapLink.cpp:48: error: class ‘WebCore::AccessibilityImageMapLink’ does not have any field named ‘m_role’
even though this works fine
AccessibilityImageMapLink::AccessibilityImageMapLink() { m_role = WebCoreLinkRole; }
any tips?
thanx _______________________________________________ webkit-dev mailing list webkit-dev@lists.webkit.org http://lists.webkit.org/mailman/listinfo.cgi/webkit-dev
participants (4)
-
Chris Fleizach
-
Darin Adler
-
David Hyatt
-
Luka Napotnik