Squash memory leak and an offset problem related to helphints

svn path=/trunk/netsurf/; revision=10137
This commit is contained in:
Chris Young 2010-03-17 22:15:03 +00:00
parent 1fedc6a36a
commit c17ff1e9ae
3 changed files with 18 additions and 7 deletions

View File

@ -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);
}
}

View File

@ -123,6 +123,7 @@ struct gui_window
struct List dllist;
struct content *favicon;
bool throbbing;
char *tabtitle;
};
void ami_get_msg(void);

View File

@ -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,