WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
54902
[Qt] [WK2] Improve the memory handling of the context menu for WebKit 2
https://bugs.webkit.org/show_bug.cgi?id=54902
Summary
[Qt] [WK2] Improve the memory handling of the context menu for WebKit 2
Benjamin Poulain
Reported
2011-02-21 12:52:47 PST
Currently, the QWKPage emit a signal when the context menu should be shown, a pointer to the menu being passed as parameter. The memory is handled by the receiver of the signal. I did the design that way because the WebKit 2 apis do not prevent showContextMenu() from being called multiple time. I now think it was a mistake because that make memory handling unreliable, and couple QGraphicsWKView and QWKPage via signals, which is a terrible idea... For example, disconnecting the default signal-slot connexion leaks the menus.
Attachments
Patch
(8.35 KB, patch)
2011-02-21 12:59 PST
,
Benjamin Poulain
no flags
Details
Formatted Diff
Diff
Patch
(8.36 KB, patch)
2011-02-22 04:33 PST
,
Benjamin Poulain
no flags
Details
Formatted Diff
Diff
Show Obsolete
(1)
View All
Add attachment
proposed patch, testcase, etc.
Benjamin Poulain
Comment 1
2011-02-21 12:59:43 PST
Created
attachment 83208
[details]
Patch
Kenneth Rohde Christiansen
Comment 2
2011-02-22 00:37:46 PST
Comment on
attachment 83208
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=83208&action=review
> Source/WebKit2/UIProcess/qt/WebContextMenuProxyQt.cpp:97 > + OwnPtr<QMenu> menu(new QMenu);
Why not create this as a PassOwnPtr? like in the PassRefPtr example here?
http://www.webkit.org/coding/RefPtr.html
Benjamin Poulain
Comment 3
2011-02-22 02:34:13 PST
(In reply to
comment #2
)
> Why not create this as a PassOwnPtr? like in the PassRefPtr example here?
http://www.webkit.org/coding/RefPtr.html
I think the semantic of OwnPtr is better than PassPtr for this function. In the doc you mention, on top of the example, there is // example, not preferred style; should use RefCounted and adoptRef (see below) there is "we recommend PassRefPtr only for function argument and result types" in the text.
Benjamin Poulain
Comment 4
2011-02-22 02:35:27 PST
Comment on
attachment 83208
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=83208&action=review
>> Source/WebKit2/UIProcess/qt/WebContextMenuProxyQt.cpp:97 >> + OwnPtr<QMenu> menu(new QMenu); > > Why not create this as a PassOwnPtr? like in the PassRefPtr example here?
http://www.webkit.org/coding/RefPtr.html
This should use adoptPtr() or it won't build without LOOSE_PASS_OWN_PTR defined.
Benjamin Poulain
Comment 5
2011-02-22 04:33:16 PST
Created
attachment 83299
[details]
Patch
WebKit Commit Bot
Comment 6
2011-02-22 05:25:30 PST
Comment on
attachment 83299
[details]
Patch Clearing flags on attachment: 83299 Committed
r79316
: <
http://trac.webkit.org/changeset/79316
>
WebKit Commit Bot
Comment 7
2011-02-22 05:25:35 PST
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