On Fri, Oct 15, 2004 at 02:51:21PM +0200, Matthias Franz wrote:
Hi everybody,
I'm writing a patch for a better treatment of anchor names in HTML pages. During this, I've come across the following bug in Dillo.
Jorge: I think this is what produced the bug in the patch I sent you.
Thanks for the tip. (more on this later). But keep on reading... ;)
Entries are never removed from the hash table anchors_table, which stores the anchors of a page (see dw_gtk_viewport.c). This means that whenever a new page is displayed in the same viewport, the old anchors remain in the hash table, but their keys are overwritten. Like in this example: (The "###" lines are debug information I've inserted.)
~$ dillo http://www.google.de dillo_dns_init: Here we go! Disabling cookies. ### Dw_gtk_viewport_init: anchors_table init Nav_open_url: Url=>about:splash< Nav_open_url: Url=>http://www.google.de< Dns_server [0]: www.google.de is 0x8100ea8 Connecting to 66.102.9.99 ### size(anchors_table) = 0 ### entries: ### Html_add_anchor: adding anchor 1a ### size(anchors_table) = 1 ### entries: <1a> ### Html_add_anchor: adding anchor 2a ### size(anchors_table) = 2 ### entries: <2a> <1a> ### Html_add_anchor: adding anchor 3a ### size(anchors_table) = 3 ### entries: <3a> <2a> <1a> ### Html_add_anchor: adding anchor 4a ### size(anchors_table) = 4 ### entries: <4a> <3a> <2a> <1a> ### Html_add_anchor: adding anchor all ### size(anchors_table) = 5 ### entries: <4a> <all> <3a> <2a> <1a> ### Html_add_anchor: adding anchor lgr ### size(anchors_table) = 6 ### entries: <4a> <all> <3a> <2a> <1a> <lgr> ### Html_add_anchor: adding anchor cty Nav_open_url: Url=>http://www.google.de/imghp?hl=de&tab=wi&ie=UTF-8< Connecting to 66.102.9.99 ### size(anchors_table) = 7 ### entries: <> <> <h3> <> <¸1> <À(> <> ### Html_add_anchor: adding anchor 0a ### size(anchors_table) = 8 ### entries: <0a> <> <> <h3> <> <¸1> <> <> ### Html_add_anchor: adding anchor 2a ### size(anchors_table) = 9 ### entries: <0a> <> <> <h3> <> <2a> <¸1> <> <> ### Html_add_anchor: adding anchor 3a ### size(anchors_table) = 10 ### entries: <0a> <> <> <h3> <3a> <> <2a> <¸1> <> <> ### Html_add_anchor: adding anchor 4a Dillo: normal exit!
Obviously, the anchors_table must be cleared whenever a new page is displayed. I don't know the dw* part of Dillo very well, and the connection between the html structure and the viewport seems to be quite indirect. Can anyone suggest a fix?
Please wait for Sebastian to answer this one. I remember being through the handling code for anchors in the past, and it has its subtleties for sure. I'll review the patch you sent me in detail now, and send you my comments on the approach. I'm busy with the rc2 work now. This patch shouldn't go in because this stage is a bugfix only (and the dillo-0.8.3 release is very delayed now :( ). BTW, did you had the time to test the race condition patch in the CVS? -- Cheers Jorge.-