From c17ff1e9aeab9a2f078af06d524552b872a20558 Mon Sep 17 00:00:00 2001 From: Chris Young Date: Wed, 17 Mar 2010 22:15:03 +0000 Subject: Squash memory leak and an offset problem related to helphints svn path=/trunk/netsurf/; revision=10137 --- amiga/gui.c | 15 +++++++++++---- amiga/gui.h | 1 + amiga/history_local.c | 9 ++++++--- 3 files changed, 18 insertions(+), 7 deletions(-) (limited to 'amiga') diff --git a/amiga/gui.c b/amiga/gui.c index 34a9f8a45..33d032b5f 100755 --- a/amiga/gui.c +++ b/amiga/gui.c @@ -2928,12 +2928,15 @@ void gui_window_destroy(struct gui_window *g) if(g->shared->tabs == 1) ami_toggletabbar(g->shared, false); + ami_utf8_free(g->tabtitle); + FreeVec(g); return; } DisposeObject(g->shared->objects[OID_MAIN]); + free(g->shared->wintitle); ami_utf8_free(g->shared->status); FreeVec(g->shared->svbuffer); @@ -2972,8 +2975,9 @@ void gui_window_set_title(struct gui_window *g, const char *title) { node = g->tab_node; - SetGadgetAttrs((struct Gadget *)g->shared->objects[GID_TABS],g->shared->win,NULL, - CLICKTAB_Labels,~0, + SetGadgetAttrs((struct Gadget *)g->shared->objects[GID_TABS], + g->shared->win, NULL, + CLICKTAB_Labels, ~0, TAG_DONE); SetClickTabNodeAttrs(node, TNA_Text, utf8title, @@ -2985,6 +2989,9 @@ void gui_window_set_title(struct gui_window *g, const char *title) CLICKTAB_Labels, &g->shared->tab_list, TAG_DONE); + if(g->tabtitle) ami_utf8_free(g->tabtitle); + g->tabtitle = utf8title; + if(ClickTabBase->lib_Version < 53) RethinkLayout((struct Gadget *)g->shared->objects[GID_TABLAYOUT], g->shared->win, NULL, TRUE); @@ -2997,8 +3004,8 @@ void gui_window_set_title(struct gui_window *g, const char *title) { if((g->shared->wintitle == NULL) || (strcmp(utf8title, g->shared->wintitle))) { - if(g->shared->wintitle) ami_utf8_free(g->shared->wintitle); - g->shared->wintitle = utf8title; + if(g->shared->wintitle) free(g->shared->wintitle); + g->shared->wintitle = strdup(utf8title); SetWindowTitles(g->shared->win, g->shared->wintitle, nsscreentitle); } } diff --git a/amiga/gui.h b/amiga/gui.h index 764c3a17e..14bf794ce 100755 --- a/amiga/gui.h +++ b/amiga/gui.h @@ -123,6 +123,7 @@ struct gui_window struct List dllist; struct content *favicon; bool throbbing; + char *tabtitle; }; void ami_get_msg(void); diff --git a/amiga/history_local.c b/amiga/history_local.c index 0f087aad0..d68b6de1e 100755 --- a/amiga/history_local.c +++ b/amiga/history_local.c @@ -233,6 +233,7 @@ BOOL ami_history_event(struct history_window *hw) struct MenuItem *item; char *url; struct IBox *bbox; + ULONG xs, ys; while((result = RA_HandleInput(hw->objects[OID_MAIN],&code)) != WMHI_LASTMSG) { @@ -251,11 +252,13 @@ BOOL ami_history_event(struct history_window *hw) */ case WMHI_MOUSEMOVE: - GetAttr(SPACE_AreaBox,hw->gadgets[GID_BROWSER],(ULONG *)&bbox); + GetAttr(SPACE_AreaBox, hw->gadgets[GID_BROWSER], (ULONG *)&bbox); + GetAttr(SCROLLER_Top, hw->objects[OID_HSCROLL], (ULONG *)&xs); + GetAttr(SCROLLER_Top, hw->objects[OID_VSCROLL], (ULONG *)&ys); url = history_position_url(history_current, - hw->win->MouseX - bbox->Left, - hw->win->MouseY - bbox->Top); + hw->win->MouseX - bbox->Left + xs, + hw->win->MouseY - bbox->Top + ys); RefreshSetGadgetAttrs((APTR)hw->gadgets[GID_BROWSER], hw->win, NULL, -- cgit v1.2.3