WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
Bug 112913
[ATK] [WebKit2] AccessibilityUIElement often leaks its AtkObject
https://bugs.webkit.org/show_bug.cgi?id=112913
Summary
[ATK] [WebKit2] AccessibilityUIElement often leaks its AtkObject
Martin Robinson
Reported
2013-03-21 07:32:47 PDT
AccessibilityUIElements are created often by passing the result of atk_object_ref_accessible_child, which returns a new reference (transfer full). AccessibilityUIElement::~AccessibilityUIElement does not decrement the reference count of the element, so it will leak. Instead AccessibilityUIElement should have a RefPtr to the element and the constructor should be carefully not to leak when assigning the value to the RefPtr.
Attachments
Proposed patch
(2.72 KB, patch)
2013-04-24 03:31 PDT
,
Krzysztof Czech
no flags
Details
Formatted Diff
Diff
Proposed patch
(2.95 KB, patch)
2013-04-24 05:25 PDT
,
Krzysztof Czech
buildbot
: commit-queue-
Details
Formatted Diff
Diff
Archive of layout-test-results from webkit-ews-11 for mac-mountainlion-wk2
(793.49 KB, application/zip)
2013-04-24 11:15 PDT
,
Build Bot
no flags
Details
Patch
(23.96 KB, patch)
2013-05-16 02:53 PDT
,
Krzysztof Czech
no flags
Details
Formatted Diff
Diff
Patch
(23.29 KB, patch)
2013-05-17 02:21 PDT
,
Krzysztof Czech
no flags
Details
Formatted Diff
Diff
Patch
(25.94 KB, patch)
2013-05-20 04:22 PDT
,
Krzysztof Czech
no flags
Details
Formatted Diff
Diff
Patch
(25.96 KB, patch)
2013-05-20 05:42 PDT
,
Krzysztof Czech
no flags
Details
Formatted Diff
Diff
Show Obsolete
(5)
View All
Add attachment
proposed patch, testcase, etc.
Krzysztof Czech
Comment 1
2013-04-24 03:31:52 PDT
Created
attachment 199409
[details]
Proposed patch Proposed patch. It could be either added a WebKit's smart pointer to PlatformUIElement or some cleanup done in AccessibilityUIElement's desctuctor. atk/AccessibilityUIElementAtk provides a way to add platform independent destructor, when reference can be decreased. Waiting for opinions about this solution ?.
Mario Sanchez Prada
Comment 2
2013-04-24 03:55:03 PDT
Comment on
attachment 199409
[details]
Proposed patch View in context:
https://bugs.webkit.org/attachment.cgi?id=199409&action=review
Looks good to me, I just made a couple of minor suggestions.
> Tools/WebKitTestRunner/InjectedBundle/atk/AccessibilityUIElementAtk.cpp:423 > + if (target) > + g_object_ref(target); > return target ? AccessibilityUIElement::create(target) : 0;
You can merge that g_object_ref call into the return line: return target ? AccessibilityUIElement::create(g_object_ref(target)) : 0;
> Tools/WebKitTestRunner/InjectedBundle/atk/AccessibilityUIElementAtk.cpp:434 > + if (parent) > + g_object_ref(parent); > return parent ? AccessibilityUIElement::create(parent) : 0;
Same here
Krzysztof Czech
Comment 3
2013-04-24 05:25:22 PDT
Created
attachment 199416
[details]
Proposed patch
Krzysztof Czech
Comment 4
2013-04-24 05:26:15 PDT
Applied Mario's suggestions.
Martin Robinson
Comment 5
2013-04-24 07:28:28 PDT
Comment on
attachment 199416
[details]
Proposed patch Thanks for working on this! I prefer using GRefPtr everywhere.
Build Bot
Comment 6
2013-04-24 11:15:45 PDT
Comment on
attachment 199416
[details]
Proposed patch
Attachment 199416
[details]
did not pass mac-wk2-ews (mac-wk2): Output:
http://webkit-queues.appspot.com/results/126275
New failing tests: fast/repaint/japanese-rl-selection-repaint-in-regions.html
Build Bot
Comment 7
2013-04-24 11:15:48 PDT
Created
attachment 199502
[details]
Archive of layout-test-results from webkit-ews-11 for mac-mountainlion-wk2 The attached test failures were seen while running run-webkit-tests on the mac-wk2-ews. Bot: webkit-ews-11 Port: mac-mountainlion-wk2 Platform: Mac OS X 10.8.2
Krzysztof Czech
Comment 8
2013-05-16 02:53:51 PDT
Created
attachment 201937
[details]
Patch
Krzysztof Czech
Comment 9
2013-05-16 02:56:39 PDT
(In reply to
comment #5
)
> (From update of
attachment 199416
[details]
) > Thanks for working on this! I prefer using GRefPtr everywhere.
Changed to GRefPtr.
Mario Sanchez Prada
Comment 10
2013-05-16 05:44:57 PDT
Comment on
attachment 201937
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=201937&action=review
> Tools/WebKitTestRunner/InjectedBundle/AccessibilityUIElement.h:252 > +#if PLATFORM(GTK) || (PLATFORM(EFL) && HAVE(ACCESSIBILITY)) > + GRefPtr<AtkObject> m_element; > +#else > PlatformUIElement m_element; > +#endif
Would it be possible to update the typedef AtkObject* PlatformUIElement in this file to be typedef GRefPtr<AtkObject> PlatformUIElement, instead of changing this here?
> Tools/WebKitTestRunner/InjectedBundle/atk/AccessibilityUIElementAtk.cpp:283 > + return m_element.get() == otherElement->platformUIElement();
I think you don't need the .get() here
> Tools/WebKitTestRunner/InjectedBundle/atk/AccessibilityUIElementAtk.cpp:288 > + if (!m_element.get() || !ATK_IS_OBJECT(m_element.get()))
I don't think you need to use get() for checking !m_element.
Krzysztof Czech
Comment 11
2013-05-17 01:57:05 PDT
(In reply to
comment #10
)
> (From update of
attachment 201937
[details]
) > View in context:
https://bugs.webkit.org/attachment.cgi?id=201937&action=review
> > > Tools/WebKitTestRunner/InjectedBundle/AccessibilityUIElement.h:252 > > +#if PLATFORM(GTK) || (PLATFORM(EFL) && HAVE(ACCESSIBILITY)) > > + GRefPtr<AtkObject> m_element; > > +#else > > PlatformUIElement m_element; > > +#endif > > Would it be possible to update the typedef AtkObject* PlatformUIElement in this file to be typedef GRefPtr<AtkObject> PlatformUIElement, instead of changing this here?
Probably it would be feasible. It requires some additional casting code in AccessibilityController.cpp (rootElement and focusedElement methods) I'm wondering, PlatformUIElement is used also as a constructor and function's parameter and a return value as well. Would it be too much refs and derefs of temporary objects ?. What to you think about it ?.
> > > Tools/WebKitTestRunner/InjectedBundle/atk/AccessibilityUIElementAtk.cpp:283 > > + return m_element.get() == otherElement->platformUIElement(); > > I think you don't need the .get() here
Right
> > > Tools/WebKitTestRunner/InjectedBundle/atk/AccessibilityUIElementAtk.cpp:288 > > + if (!m_element.get() || !ATK_IS_OBJECT(m_element.get())) > > I don't think you need to use get() for checking !m_element.
Right
Krzysztof Czech
Comment 12
2013-05-17 02:21:55 PDT
Created
attachment 202052
[details]
Patch
Mario Sanchez Prada
Comment 13
2013-05-17 02:58:05 PDT
(In reply to
comment #11
)
> [...] > Probably it would be feasible. It requires some additional casting code in > AccessibilityController.cpp (rootElement and focusedElement methods)
Yes, I was not expecting it to be a one liner change, that's why I asked. In any case, it's just a suggestion, but if it's too cumbersome and/or nobody else sees a benefit on this, I'd be fine with the current solution.
> I'm wondering, PlatformUIElement is used also as a constructor and function's > parameter and a return value as well. Would it be too much refs and derefs of > temporary objects ?. What to you think about it ?.
Hrm... I see. Maybe it's going to be too much then, you could just use PassRefPtr if they were not GObjects, but you have GRefPtr here, and that would mean I'm afraid too many changes for what it should be something quite simple in the end. So, I think I'm leaning more towards keeping it as you have it right now unless, as I said before, anyone else opposes to it. Thanks for considering my suggestions
Martin Robinson
Comment 14
2013-05-17 11:45:51 PDT
Comment on
attachment 202052
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=202052&action=review
> Tools/WebKitTestRunner/InjectedBundle/AccessibilityUIElement.cpp:58 > +#if PLATFORM(GTK) || (PLATFORM(EFL) && HAVE(ACCESSIBILITY)) > + return m_element.get(); > +#else > + return m_element; > +#endif > +}
I don't believe you need this #ifdef here. Doesn't GRefPtr should be support implicit casts to boolean?
> Tools/WebKitTestRunner/InjectedBundle/AccessibilityUIElement.cpp:66 > +#if PLATFORM(GTK) || (PLATFORM(EFL) && HAVE(ACCESSIBILITY)) > + return m_element.get(); > +#else > + return m_element; > +#endif
This is a bit ugly...perhaps Mario is right and GRefPtr<...> should be typedef'd to PlatformUIElement.
Krzysztof Czech
Comment 15
2013-05-20 04:22:50 PDT
Created
attachment 202270
[details]
Patch
Krzysztof Czech
Comment 16
2013-05-20 04:24:56 PDT
(In reply to
comment #14
)
> (From update of
attachment 202052
[details]
) > View in context:
https://bugs.webkit.org/attachment.cgi?id=202052&action=review
> > > Tools/WebKitTestRunner/InjectedBundle/AccessibilityUIElement.cpp:58 > > +#if PLATFORM(GTK) || (PLATFORM(EFL) && HAVE(ACCESSIBILITY)) > > + return m_element.get(); > > +#else > > + return m_element; > > +#endif > > +} > > I don't believe you need this #ifdef here. Doesn't GRefPtr should be support implicit casts to boolean?
You are right.
> > > Tools/WebKitTestRunner/InjectedBundle/AccessibilityUIElement.cpp:66 > > +#if PLATFORM(GTK) || (PLATFORM(EFL) && HAVE(ACCESSIBILITY)) > > + return m_element.get(); > > +#else > > + return m_element; > > +#endif > > This is a bit ugly...perhaps Mario is right and GRefPtr<...> should be typedef'd to PlatformUIElement.
I changed.
Mario Sanchez Prada
Comment 17
2013-05-20 05:25:55 PDT
Comment on
attachment 202270
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=202270&action=review
> Tools/WebKitTestRunner/InjectedBundle/AccessibilityUIElement.h:55 > +#include <wtf/gobject/GRefPtr.h> > +typedef GRefPtr<AtkObject> PlatformUIElement;
Beautiful!
> Tools/WebKitTestRunner/InjectedBundle/atk/AccessibilityUIElementAtk.cpp:86 > + if (!element.get() || !ATK_IS_OBJECT(element.get()))
Just if (!element || ...) Sorry not to having caught this one before
> Tools/WebKitTestRunner/InjectedBundle/atk/AccessibilityUIElementAtk.cpp:122 > + if (!element.get() || !ATK_IS_VALUE(element.get()))
Same here
Krzysztof Czech
Comment 18
2013-05-20 05:42:22 PDT
Created
attachment 202273
[details]
Patch
Krzysztof Czech
Comment 19
2013-05-20 05:43:15 PDT
> > Tools/WebKitTestRunner/InjectedBundle/atk/AccessibilityUIElementAtk.cpp:86 > > + if (!element.get() || !ATK_IS_OBJECT(element.get())) > > Just if (!element || ...) > > Sorry not to having caught this one before
Thanks, done.
> > > Tools/WebKitTestRunner/InjectedBundle/atk/AccessibilityUIElementAtk.cpp:122 > > + if (!element.get() || !ATK_IS_VALUE(element.get())) > > Same here
Done.
WebKit Commit Bot
Comment 20
2013-05-21 01:43:31 PDT
Comment on
attachment 202273
[details]
Patch Clearing flags on attachment: 202273 Committed
r150431
: <
http://trac.webkit.org/changeset/150431
>
WebKit Commit Bot
Comment 21
2013-05-21 01:43:35 PDT
All reviewed patches have been landed. Closing bug.
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug