# HG changeset patch # User Sadrul Habib Chowdhury # Date 1162414763 0 # Node ID 5228f8cf2a6aefdd5170e8ce589d68a2103a06b1 # Parent 0e4833acd31c5061960ce4f87abc9d599c4692c8 [gaim-migrate @ 17650] Print a debug message if someone tries to specify a binding for some non-existent action. Make sure the conversation windows aren't too large to cause a crash. raise(SIGABRT) instead of exit() to force a coredump if something goes wrong with stdin. committer: Tailor Script diff -r 0e4833acd31c -r 5228f8cf2a6a console/libgnt/gntmain.c --- a/console/libgnt/gntmain.c Wed Nov 01 19:23:39 2006 +0000 +++ b/console/libgnt/gntmain.c Wed Nov 01 20:59:23 2006 +0000 @@ -774,16 +774,17 @@ int rd = read(STDIN_FILENO, keys, sizeof(keys) - 1); if (rd < 0) { + int ch = getch(); /* This should return ERR, but let's see what it really returns */ endwin(); printf("ERROR: %s\n", strerror(errno)); - printf("File descriptor is: %d\n\nGIOChannel is: %p", STDIN_FILENO, source); - exit(1); + printf("File descriptor is: %d\n\nGIOChannel is: %p\ngetch() = %d\n", STDIN_FILENO, source, ch); + raise(SIGABRT); } else if (rd == 0) { endwin(); printf("EOF\n"); - exit(1); + raise(SIGABRT); } event_stack = TRUE; @@ -1115,11 +1116,11 @@ (G_IO_IN | G_IO_HUP | G_IO_ERR | G_IO_PRI | G_IO_NVAL), io_invoke, NULL, NULL); - locale = setlocale(LC_ALL, ""); + g_io_channel_unref(channel); /* Apparently this caused crashes for some people. + But irssi does this, so I am going to assume the + crashes were caused by some other stuff. */ -#if 0 - g_io_channel_unref(channel); /* Apparently this causes crash for some people */ -#endif + locale = setlocale(LC_ALL, ""); if (locale && (strstr(locale, "UTF") || strstr(locale, "utf"))) ascii_only = FALSE; diff -r 0e4833acd31c -r 5228f8cf2a6a console/libgnt/gnttextview.c --- a/console/libgnt/gnttextview.c Wed Nov 01 19:23:39 2006 +0000 +++ b/console/libgnt/gnttextview.c Wed Nov 01 20:59:23 2006 +0000 @@ -211,7 +211,8 @@ } view->list = list; GNT_WIDGET_UNSET_FLAGS(GNT_WIDGET(view), GNT_WIDGET_DRAWING); - gnt_widget_draw(GNT_WIDGET(view)); + if (GNT_WIDGET(view)->window) + gnt_widget_draw(GNT_WIDGET(view)); g_string_free(string, TRUE); } diff -r 0e4833acd31c -r 5228f8cf2a6a console/libgnt/gntwidget.c --- a/console/libgnt/gntwidget.c Wed Nov 01 19:23:39 2006 +0000 +++ b/console/libgnt/gntwidget.c Wed Nov 01 20:59:23 2006 +0000 @@ -711,14 +711,24 @@ register_binding(GntWidgetClass *klass, const char *name, const char *trigger, GList *list) { GntWidgetActionParam *param; + GntWidgetAction *action; if (name == NULL || *name == '\0') { g_hash_table_remove(klass->bindings, (char*)trigger); return; } + action = g_hash_table_lookup(klass->actions, name); + if (!action) { + g_printerr("GntWidget: Invalid action name %s for %s\n", + name, g_type_name(G_OBJECT_CLASS_TYPE(klass))); + if (list) + g_list_free(list); + return; + } + param = g_new0(GntWidgetActionParam, 1); - param->action = g_hash_table_lookup(klass->actions, name); + param->action = action; param->list = list; g_hash_table_replace(klass->bindings, g_strdup(trigger), param); }