Allocate window title string memory dynamically.

svn path=/trunk/netsurf/; revision=12111
This commit is contained in:
Ole Loots 2011-03-20 22:38:32 +00:00
parent 7f38f0f70e
commit 2e8d22b83d
2 changed files with 8 additions and 2 deletions

View File

@ -55,6 +55,7 @@
#include "atari/plot/plotter.h"
#include "atari/dragdrop.h"
#include "atari/search.h"
#include "atari/osspec.h"
bool cfg_rt_resize = false;
@ -116,6 +117,7 @@ int window_create( struct gui_window * gw, struct browser_window * bw, unsigned
if( gw->root == NULL )
return( -1 );
memset( gw->root, 0, sizeof(struct s_gui_win_root) );
gw->root->title = malloc(atari_sysinfo.aes_max_win_title_len+1);
gw->root->handle = WindCreate( flags,40, 40, app.w, app.h );
gw->root->cmproot = mt_CompCreate(&app, CLT_VERTICAL, 1, 1);
WindSetPtr( gw->root->handle, WF_COMPONENT, gw->root->cmproot, NULL);
@ -140,8 +142,9 @@ int window_create( struct gui_window * gw, struct browser_window * bw, unsigned
}
WindSetStr(gw->root->handle, WF_ICONTITLE, (char*)"NetSurf");
EvntDataAttach( gw->root->handle, WM_CLOSED, evnt_window_close, NULL );
/* Event Handlers: */
EvntDataAttach( gw->root->handle, WM_CLOSED, evnt_window_close, NULL );
/* capture resize/move events so we can handle that manually */
if( !cfg_rt_resize ) {
EvntAttach( gw->root->handle, WM_SIZED, evnt_window_resize);
@ -206,6 +209,9 @@ int window_destroy( struct gui_window * gw)
/* needed? */ /*listRemove( (LINKABLE*)gw->root->cmproot ); */
LOG(("Freeing root window"));
if( gw->root ) {
/* TODO: check if no other browser is bound to this root window! */
if( gw->root->title )
free( gw->root->title );
if( gw->root->cmproot )
mt_CompDelete( &app, gw->root->cmproot );
ApplWrite( _AESapid, WM_DESTROY, gw->root->handle->handle, 0, 0, 0, 0);

View File

@ -217,7 +217,7 @@ struct s_gui_win_root
struct s_focus_info focus;
float scale;
bool throbbing;
char title[80];
char * title;
GRECT loc; /* current size of window on screen */
};