Attempt to fix a crash adding hotlist entries to the toolbar

This commit is contained in:
Chris Young 2015-01-31 11:21:14 +00:00
parent 8fb6f4d148
commit 8dc707d554

View File

@ -1790,6 +1790,7 @@ static void ami_handle_msg(void)
nnode=(struct nsObject *)GetSucc((struct Node *)node); nnode=(struct nsObject *)GetSucc((struct Node *)node);
gwin = node->objstruct; gwin = node->objstruct;
LOG(("Type %d", node->Type));
if(node->Type == AMINS_TVWINDOW) { if(node->Type == AMINS_TVWINDOW) {
if(ami_tree_event((struct treeview_window *)gwin)) { if(ami_tree_event((struct treeview_window *)gwin)) {
@ -1850,11 +1851,10 @@ static void ami_handle_msg(void)
} }
} }
if(gwin->objects[OID_MAIN] == NULL) continue; if((gwin == NULL) || (gwin->objects[OID_MAIN] == NULL)) continue;
LOG(("while..."));
while((result = RA_HandleInput(gwin->objects[OID_MAIN],&code)) != WMHI_LASTMSG) while((result = RA_HandleInput(gwin->objects[OID_MAIN], &code)) != WMHI_LASTMSG) {
{ LOG(("%d: %d (switch)",code, result & WMHI_CLASSMASK));
//printf("%ld: %ld (switch)\n",code, result & WMHI_CLASSMASK);
switch(result & WMHI_CLASSMASK) // class switch(result & WMHI_CLASSMASK) // class
{ {
case WMHI_MOUSEMOVE: case WMHI_MOUSEMOVE:
@ -3124,7 +3124,11 @@ static bool ami_gui_hotlist_add(void *userdata, int level, int item, const char
if(item > AMI_GUI_TOOLBAR_MAX) return false; if(item > AMI_GUI_TOOLBAR_MAX) return false;
if(is_folder == true) return false; if(is_folder == true) return false;
if(title) {
tb_userdata->gw->hotlist_toolbar_lab[item] = ami_utf8_easy(title); tb_userdata->gw->hotlist_toolbar_lab[item] = ami_utf8_easy(title);
} else {
tb_userdata->gw->hotlist_toolbar_lab[item] = strdup("(untitled)");
}
speed_button_node = AllocSpeedButtonNode(item, speed_button_node = AllocSpeedButtonNode(item,
SBNA_Text, tb_userdata->gw->hotlist_toolbar_lab[item], SBNA_Text, tb_userdata->gw->hotlist_toolbar_lab[item],