Bug 26517

Summary: webkit_web_back_forward_list_add_item() should add a ref for the history item
Product: WebKit Reporter: Oliver Gerlich <oliver.gerlich>
Component: WebKitGTKAssignee: Nobody <webkit-unassigned>
Status: RESOLVED FIXED    
Severity: Normal CC: jmalonzo
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: PC   
OS: Linux   
Attachments:
Description Flags
ref the newly created items so the caller can take ownership of the item
none
updated patch xan.lopez: review+

Oliver Gerlich
Reported 2009-06-18 14:35:15 PDT
When using the pywebkitgtk bindings to manually add a WebKitWebHistoryItem to a back-forward-list using WebKitWebBackForwardList.add_item(), the caller currently has to keep a reference to the item because otherwise the item is destroyed. Example: for uri in ["http://example.com/1/", "http://example.com/2/"]: item = WebHistoryItem(uri, "") bf_list.add_item(item) backList = bf_list.get_back_list_with_limit(10) This leads to a crash in the last line. Keeping the created WebHistoryItems referenced in Python (eg. by putting them into a global list) works around the problem. From what I understand, to fix this, add_item should add a reference to the item itself, so that the caller doesn't have to manually keep a reference. This happens with webkit-gtk 1.1.9 and pywebkitgtk 1.1.5 and Python 2.6.2, on Ubuntu Jaunty (9.04).
Attachments
ref the newly created items so the caller can take ownership of the item (5.38 KB, patch)
2009-06-19 17:54 PDT, Jan Alonzo
no flags
updated patch (4.70 KB, patch)
2009-06-20 07:24 PDT, Jan Alonzo
xan.lopez: review+
Jan Alonzo
Comment 1 2009-06-19 17:54:07 PDT
Created attachment 31581 [details] ref the newly created items so the caller can take ownership of the item
Jan Alonzo
Comment 2 2009-06-20 07:24:58 PDT
Created attachment 31596 [details] updated patch Add a ref when adding the item in the back forward list per kov and xan's feedback in IRC.
Xan Lopez
Comment 3 2009-06-20 07:37:08 PDT
Comment on attachment 31596 [details] updated patch Please update the docs also, r=me.
Jan Alonzo
Comment 4 2009-06-20 14:58:55 PDT
(In reply to comment #3) > (From update of attachment 31596 [details] [review]) > Please update the docs also, r=me. > Landed in r44903
Note You need to log in before you can comment on or make changes to this bug.