Branch: refs/heads/master Author: Colomban Wendling ban@herbesfolles.org Committer: Colomban Wendling ban@herbesfolles.org Date: Sat, 25 Oct 2014 13:05:38 UTC Commit: ecb4ba7aadf0cc1920d2ac7323e435fb22201e1e https://github.com/geany/geany-plugins/commit/ecb4ba7aadf0cc1920d2ac7323e435...
Log Message: ----------- debugger: Don't work on NULL GString or GHashTable
Modified Paths: -------------- debugger/src/dbm_gdb.c debugger/src/debug.c
Modified: debugger/src/dbm_gdb.c 6 lines changed, 4 insertions(+), 2 deletions(-) =================================================================== @@ -259,9 +259,11 @@ static void gdb_input_write_line(const gchar *line) */ static void free_queue_item(queue_item *item) { - g_string_free(item->message, TRUE); + if (item->message) + g_string_free(item->message, TRUE); g_string_free(item->command, TRUE); - g_string_free(item->error_message, TRUE); + if (item->error_message) + g_string_free(item->error_message, TRUE); g_free(item); }
Modified: debugger/src/debug.c 46 lines changed, 25 insertions(+), 21 deletions(-) =================================================================== @@ -662,7 +662,8 @@ static void on_debugger_stopped (int thread_id) }
/* clear calltips cache */ - g_hash_table_remove_all(calltips); + if (calltips) + g_hash_table_remove_all(calltips);
/* if a stop was requested for asyncronous exiting - * stop debug module and exit */ @@ -927,7 +928,8 @@ static void on_select_frame(int frame_number) active_module->set_active_frame(frame_number); /* clear calltips cache */ - g_hash_table_remove_all(calltips); + if (calltips) + g_hash_table_remove_all(calltips); /* autos */ autos = active_module->get_autos(); @@ -1326,33 +1328,35 @@ gchar* debug_get_calltip_for_expression(gchar* expression) if (var) { calltip_str = get_calltip_line(var, TRUE); - if (var->has_children) + if (calltip_str) { - int lines_left = MAX_CALLTIP_HEIGHT - 1; - GList* children = active_module->get_children(var->internal->str); - GList* child = children; - while(child && lines_left) + if (var->has_children) { - variable *varchild = (variable*)child->data; - GString *child_string = get_calltip_line(varchild, FALSE); - g_string_append_printf(calltip_str, "\n%s", child_string->str); - g_string_free(child_string, TRUE); + int lines_left = MAX_CALLTIP_HEIGHT - 1; + GList* children = active_module->get_children(var->internal->str); + GList* child = children; + while(child && lines_left) + { + variable *varchild = (variable*)child->data; + GString *child_string = get_calltip_line(varchild, FALSE); + g_string_append_printf(calltip_str, "\n%s", child_string->str); + g_string_free(child_string, TRUE);
- child = child->next; - lines_left--; - } - if (!lines_left && child) - { - g_string_append(calltip_str, "\n\t\t........"); + child = child->next; + lines_left--; + } + if (!lines_left && child) + { + g_string_append(calltip_str, "\n\t\t........"); + } + g_list_foreach(children, (GFunc)variable_free, NULL); + g_list_free(children); } - g_list_foreach(children, (GFunc)variable_free, NULL); - g_list_free(children); + calltip = g_string_free(calltip_str, FALSE); }
active_module->remove_watch(var->internal->str);
- calltip = g_string_free(calltip_str, FALSE); - if (!calltips) { calltips = g_hash_table_new_full(g_str_hash, g_str_equal, (GDestroyNotify)g_free, (GDestroyNotify)g_free);
-------------- This E-Mail was brought to you by github_commit_mail.py (Source: https://github.com/geany/infrastructure).
plugins-commits@lists.geany.org