[geany/geany-plugins] 015163: scope - explicitly init global/static variables

Dimitar Zhekov git-noreply at xxxxx
Mon Jul 29 16:28:42 UTC 2013


Branch:      refs/heads/master
Author:      Dimitar Zhekov <dimitar.zhekov at gmail.com>
Committer:   Dimitar Zhekov <dimitar.zhekov at gmail.com>
Date:        Mon, 29 Jul 2013 16:28:42 UTC
Commit:      015163d0f471250d6046d999f0b9fc9bcf689854
             https://github.com/geany/geany-plugins/commit/015163d0f471250d6046d999f0b9fc9bcf689854

Log Message:
-----------
scope - explicitly init global/static variables


Modified Paths:
--------------
    scope/ChangeLog
    scope/NEWS
    scope/NOTES
    scope/docs/scope.html
    scope/src/break.c
    scope/src/conterm.c
    scope/src/debug.c
    scope/src/inspect.c
    scope/src/memory.c
    scope/src/menu.c
    scope/src/parse.c
    scope/src/program.c
    scope/src/register.c
    scope/src/scope.c
    scope/src/stack.c
    scope/src/store/scptreestore.c
    scope/src/thread.c
    scope/src/tooltip.c
    scope/src/tooltip.h
    scope/src/views.c

Modified: scope/ChangeLog
14 files changed, 14 insertions(+), 0 deletions(-)
===================================================================
@@ -1,3 +1,17 @@
+2013-07-25  Dimitar Zhekov  <dimitar.zhekov at gmail.com>
+
+ * src/break.c, src/conterm.c, src/debug.c, src/inspect.c,
+   src/memory.c, src/menu.c, src/parse.c, src/program.c,
+   src/register.c, src/scope.c, src/stack.c, src/thread.c,
+   src/tooltip.c, src/tooltip.h, src/views.c:
+   Explicitly initialize all sensitive global and static
+   variables, since reloading the plugin will not do that.
+ * src/store/scptreestore.c:
+   Fixed indentation.
+ * docs/scope.html, src/scope.c:
+   Increased version to 0.91.2.
+
+
 2013-07-11  Dimitar Zhekov  <dimitar.zhekov at gmail.com>
 
  * src/scope.c:


Modified: scope/NEWS
5 files changed, 5 insertions(+), 0 deletions(-)
===================================================================
@@ -1,3 +1,8 @@
+Scope 0.91.2 (2013-07-25)
+
+    * Fixed various errors on plugin unload-and-reload.
+
+
 Scope 0.91.1 (2013-07-11)
 
     * (Un)Block toolbar Toggle Breakpoint when saving a document or


Modified: scope/NOTES
3 files changed, 3 insertions(+), 0 deletions(-)
===================================================================
@@ -1,3 +1,6 @@
+reloading a resident geany plugin module does not reinitialize any global
+and static variables, so the sensitive ones must be initialized explicitly
+
 register modified is 07 since changing a register ($dh, $mm1.uint64) may
 change another ($dx, $st1), and there is some chance of watches/inspects
 containing a register


Modified: scope/docs/scope.html
2 files changed, 1 insertions(+), 1 deletions(-)
===================================================================
@@ -738,7 +738,7 @@
 
 <b><a name="copyright">Copyright</a></b>
 
-<p>Scope 0.91.1, Copyright (C) 2013 Dimitar Toshkov Zhekov</p>
+<p>Scope 0.91.2, Copyright (C) 2013 Dimitar Toshkov Zhekov</p>
 
 <p>The menu and toolbar icons are from <a href="http://netbeans.org">Netbeans</a>, except for
 BreakPoint.</p>


Modified: scope/src/break.c
4 files changed, 3 insertions(+), 1 deletions(-)
===================================================================
@@ -676,7 +676,7 @@ void on_break_list(GArray *nodes)
 	}
 }
 
-gint break_async = -1;
+gint break_async;
 
 void on_break_stopped(GArray *nodes)
 {
@@ -1299,6 +1299,8 @@ void break_init(void)
 	GtkWidget *menu;
 	guint i;
 
+	break_async = -1;
+
 	tree = view_connect("break_view", &store, &selection, break_cells, "break_window", NULL);
 	gtk_tree_view_column_set_cell_data_func(get_column("break_type_column"),
 		GTK_CELL_RENDERER(get_object("break_type")), break_type_set_data_func, NULL, NULL);


Modified: scope/src/conterm.c
34 files changed, 23 insertions(+), 11 deletions(-)
===================================================================
@@ -28,6 +28,7 @@
 
 #define NFD 5
 #define DS_COPY (DS_BASICS | DS_EXTRA_1)
+static int last_console_fd;
 
 #ifdef G_OS_UNIX
 #if (defined(__unix__) || defined(unix)) && !defined(USG)
@@ -167,23 +168,22 @@ void on_vte_realize(GtkWidget *widget, G_GNUC_UNUSED gpointer gdata)
 #endif
 }
 
-static VteTerminal *debug_console = NULL;  /* non-NULL == vte console */
+static VteTerminal *debug_console;  /* non-NULL == vte console */
 
 static void console_output(int fd, const char *text, gint length)
 {
 	static const char fd_colors[NFD] = { '6', '7', '1', '7', '5' };
 	static char setaf[5] = { '\033', '[', '3', '?', 'm' };
-	static int last_fd = -1;
 	gint i;
 
-	if (last_fd == 3 && fd != 0)
+	if (last_console_fd == 3 && fd != 0)
 		vte_terminal_feed(debug_console, "\r\n", 2);
 
-	if (fd != last_fd)
+	if (fd != last_console_fd)
 	{
 		setaf[3] = fd_colors[fd];
 		vte_terminal_feed(debug_console, setaf, sizeof setaf);
-		last_fd = fd;
+		last_console_fd = fd;
 	}
 
 	if (length == -1)
@@ -216,19 +216,21 @@ static void console_output_nl(int fd, const char *text, gint length)
 static GtkTextTag *fd_tags[NFD];
 #define DC_LIMIT 32768  /* approx */
 #define DC_DELTA 6144
-static guint dc_chars = 0;
+static guint dc_chars;
 
 void context_output(int fd, const char *text, gint length)
 {
-	static int last_fd = -1;
 	GtkTextIter end;
 	gchar *utf8;
 
 	gtk_text_buffer_get_end_iter(context, &end);
 
-	if (last_fd == 3 && fd != 0)
+	if (last_console_fd == 3 && fd != 0)
 		gtk_text_buffer_insert(context, &end, "\n", 1);
 
+	if (fd != last_console_fd)
+		last_console_fd = fd;
+
 	if (length == -1)
 		length = strlen(text);
 
@@ -379,18 +381,23 @@ static guint console_menu_extra_state(void)
 static MenuInfo console_menu_info = { console_menu_items, console_menu_extra_state, 0 };
 
 #ifdef G_OS_UNIX
-static int pty_slave = -1;
-char *slave_pty_name = NULL;
+static int pty_slave;
+char *slave_pty_name;
 #endif
 
 void conterm_init(void)
 {
 	GtkWidget *console;
-
 #ifdef G_OS_UNIX
 	gchar *error = NULL;
 	int pty_master;
 	char *pty_name;
+#endif
+
+	last_console_fd = -1;
+#ifdef G_OS_UNIX
+	pty_slave = -1;
+	slave_pty_name = NULL;
 
 	program_window = get_widget("program_window");
 	console = vte_terminal_new();
@@ -488,6 +495,11 @@ void conterm_init(void)
 			"#C0C0C0", "#C000C0" };
 		guint i;
 
+	#ifdef G_OS_UNIX
+		debug_console = NULL;
+	#endif
+		dc_chars = 0;
+
 		console = get_widget("debug_context");
 		gtk_widget_modify_base(console, GTK_STATE_NORMAL, &pref_vte_colour_back);
 		gtk_widget_modify_cursor(console, &pref_vte_colour_fore, &pref_vte_colour_back);


Modified: scope/src/debug.c
9 files changed, 6 insertions(+), 3 deletions(-)
===================================================================
@@ -78,7 +78,7 @@ static int kill(HANDLE pid, int sig)
 	KILLING
 } GdbState;
 
-static GdbState gdb_state = INACTIVE;
+static GdbState gdb_state;
 static GSource *gdb_source;
 static GPid gdb_pid;
 
@@ -266,7 +266,7 @@ static gboolean source_check(G_GNUC_UNUSED GSource *source)
 }
 #endif  /* G_OS_UNIX */
 
-static guint source_id = 0;
+static guint source_id;
 
 static gboolean source_dispatch(G_GNUC_UNUSED GSource *source,
 	G_GNUC_UNUSED GSourceFunc callback, G_GNUC_UNUSED gpointer gdata)
@@ -325,7 +325,7 @@ static gboolean source_dispatch(G_GNUC_UNUSED GSource *source,
 	}
 
 	reading_pos = received->str;
- 	result = waitpid(gdb_pid, &status, WNOHANG);
+	result = waitpid(gdb_pid, &status, WNOHANG);
 
 	if (result == 0)
 	{
@@ -748,6 +748,9 @@ char *debug_send_evaluate(char token, gint scid, const gchar *expr)
 
 void debug_init(void)
 {
+	gdb_state = INACTIVE;
+	source_id = 0;
+	
 	commands = g_string_sized_new(0x3FFF);
 	received = g_string_sized_new(pref_gdb_buffer_length);
 	MAXLEN = received->allocated_len - 1;


Modified: scope/src/inspect.c
14 files changed, 9 insertions(+), 5 deletions(-)
===================================================================
@@ -163,7 +163,7 @@ static void on_jump_to_menu_item_activate(GtkMenuItem *menuitem, G_GNUC_UNUSED g
 
 static GtkWidget *jump_to_item;
 static GtkContainer *jump_to_menu;
-static gchar *jump_to_expr = NULL;
+static gchar *jump_to_expr;
 
 static void on_inspect_row_inserted(GtkTreeModel *model, GtkTreePath *path, GtkTreeIter *iter,
 	G_GNUC_UNUSED gpointer gdata)
@@ -480,7 +480,7 @@ static void inspect_node_change(const ParseNode *node, G_GNUC_UNUSED gpointer gd
 	}
 }
 
-static gboolean query_all_inspects = FALSE;
+static gboolean query_all_inspects;
 
 void on_inspect_changelist(GArray *nodes)
 {
@@ -681,10 +681,10 @@ static void on_inspect_display_edited(G_GNUC_UNUSED GtkCellRendererText *rendere
 };
 
 static GObject *inspect_display;
+static gboolean last_state_active;
 
 void inspects_update_state(DebugState state)
 {
-	static gboolean last_active = FALSE;
 	gboolean active = state != DS_INACTIVE;
 	GtkTreeIter iter;
 
@@ -701,11 +701,11 @@ void inspects_update_state(DebugState state)
 		g_object_set(inspect_display, "editable", var1 && !numchild, NULL);
 	}
 
-	if (active != last_active)
+	if (active != last_state_active)
 	{
 		gtk_widget_set_sensitive(jump_to_item, active &&
 			scp_tree_store_get_iter_first(store, &iter));
-		last_active = active;
+		last_state_active = active;
 	}
 }
 
@@ -1126,6 +1126,10 @@ void inspect_init(void)
 {
 	GtkWidget *menu;
 
+	jump_to_expr = NULL;
+	query_all_inspects = FALSE;
+	last_state_active = FALSE;
+
 	jump_to_item = get_widget("inspect_jump_to_item");
 	jump_to_menu = GTK_CONTAINER(get_widget("inspect_jump_to_menu"));
 	apply_item = menu_item_find(inspect_menu_items, "inspect_apply");


Modified: scope/src/memory.c
7 files changed, 5 insertions(+), 2 deletions(-)
===================================================================
@@ -117,7 +117,7 @@ static void on_memory_bytes_editing_started(G_GNUC_UNUSED GtkCellRenderer *cell,
 
 static gint back_bytes_per_line;
 static gint bytes_per_line;
-static gint bytes_per_group = 1;
+static gint bytes_per_group;
 
 static void memory_configure(void)
 {
@@ -133,7 +133,7 @@ static void memory_configure(void)
 }
 
 static guint64 memory_start;
-static guint memory_count = 0;
+static guint memory_count;
 #define MAX_BYTES (128 * MAX_BYTES_PER_LINE)  /* +1 incomplete line */
 
 static void write_block(guint64 start, const char *contents, guint count)
@@ -382,6 +382,9 @@ void memory_init(void)
 	GtkWidget *tree = GTK_WIDGET(view_connect("memory_view", &store, &selection,
 		memory_cells, "memory_window", NULL));
 
+	bytes_per_group = 1;
+	memory_count = 0;
+
 	memory_font = *pref_memory_font ? pref_memory_font : pref_vte_font;
 	ui_widget_modify_font_from_string(tree, memory_font);
 	g_signal_connect(get_object("memory_bytes"), "editing-started",


Modified: scope/src/menu.c
10 files changed, 7 insertions(+), 3 deletions(-)
===================================================================
@@ -51,7 +51,7 @@ void menu_item_execute(const MenuInfo *menu_info, const MenuItem *menu_item, gbo
 		plugin_beep();
 }
 
-static gboolean block_execute = FALSE;
+static gboolean block_execute;
 
 void menu_item_set_active(const MenuItem *menu_item, gboolean active)
 {
@@ -109,7 +109,7 @@ static void on_menu_item_activate(GtkMenuItem *menuitem, MenuInfo *menu_info)
 	}
 }
 
-static MenuInfo *active_menu = NULL;
+static MenuInfo *active_menu;
 
 static void update_active_menu(guint state)
 {
@@ -404,7 +404,7 @@ void on_menu_update_boolean(const MenuItem *menu_item)
 	*(gboolean *) menu_item->gdata = gtk_check_menu_item_get_active(item);
 }
 
-static char *input = NULL;
+static char *input;
 static gint eval_mr_mode;
 static gint scid_gen = 0;
 
@@ -519,6 +519,10 @@ void menu_init(void)
 	GList *children = gtk_container_get_children(GTK_CONTAINER(shell));
 	GtkWidget *search2 = find_widget(shell, "search2");
 
+	block_execute = FALSE;
+	active_menu = NULL;
+	input = NULL;
+
 	popup_item = get_widget("popup_item");
 	menu_connect("popup_menu", &popup_menu_info, NULL);
 	g_signal_connect(get_widget("popup_evaluate"), "button-release-event",


Modified: scope/src/parse.c
7 files changed, 5 insertions(+), 2 deletions(-)
===================================================================
@@ -439,8 +439,8 @@ gchar *parse_get_error(GArray *nodes)
 
 #define MAXLEN 0x7FF
 static GString *errors;
-static guint errors_id = 0;
-static guint error_count = 0;
+static guint errors_id;
+static guint error_count;
 
 static gboolean errors_show(G_GNUC_UNUSED gpointer gdata)
 {
@@ -620,6 +620,9 @@ void parse_save(GKeyFile *config)
 
 void parse_init(void)
 {
+	errors_id = 0;
+	error_count = 0;
+
 	errors = g_string_sized_new(MAXLEN);
 	parse_modes = SCP_TREE_STORE(get_object("parse_mode_store"));
 	scp_tree_store_set_sort_column_id(parse_modes, MODE_NAME, GTK_SORT_ASCENDING);


Modified: scope/src/program.c
3 files changed, 2 insertions(+), 1 deletions(-)
===================================================================
@@ -307,7 +307,7 @@ void program_context_changed(void)
 
 #define build_check_execute() (build_get_execute(GEANY_BC_COMMAND) || \
 	build_get_execute(GEANY_BC_WORKING_DIR))
-static gboolean last_state_inactive = TRUE;
+static gboolean last_state_inactive;
 
 void program_update_state(DebugState state)
 {
@@ -442,6 +442,7 @@ void program_init(void)
 	extern gboolean thread_select_on_exited;
 	extern gboolean thread_select_follow;
 
+	last_state_inactive = TRUE;
 	program_dialog = dialog_connect("program_dialog");
 	program_page_vbox = get_widget("program_page_vbox");
 


Modified: scope/src/register.c
7 files changed, 5 insertions(+), 2 deletions(-)
===================================================================
@@ -70,7 +70,7 @@ static void register_node_update(const ParseNode *node, GString *commands[])
 	}
 }
 
-static gboolean query_all_registers = TRUE;
+static gboolean query_all_registers;
 
 static void registers_send_update(GArray *nodes, char token)
 {
@@ -330,7 +330,7 @@ gboolean registers_update(void)
 	return TRUE;
 }
 
-static char *last_gdb_executable = NULL;
+static char *last_gdb_executable;
 
 void registers_query_names(void)
 {
@@ -527,6 +527,9 @@ static void on_register_selection_changed(G_GNUC_UNUSED GtkTreeSelection *select
 
 void register_init(void)
 {
+	query_all_registers = TRUE;
+	last_gdb_executable = NULL;
+
 	tree = GTK_WIDGET(view_connect("register_view", &store, &selection, register_cells,
 		"register_window", &register_display));
 	gtk_widget_set_has_tooltip(tree, TRUE);


Modified: scope/src/scope.c
31 files changed, 19 insertions(+), 12 deletions(-)
===================================================================
@@ -32,7 +32,7 @@
 PLUGIN_VERSION_CHECK(215)
 
 PLUGIN_SET_TRANSLATABLE_INFO(LOCALEDIR, GETTEXT_PACKAGE, _("Scope Debugger"),
-	_("Relatively simple GDB front-end."), "0.91.1" ,
+	_("Relatively simple GDB front-end."), "0.91.2" ,
 	"Dimitar Toshkov Zhekov <dimitar.zhekov at gmail.com>")
 
 /* Keybinding(s) */
@@ -191,12 +191,13 @@ static void on_toolbar_reconfigured(GtkToolItem *tool_item, ToolItem *item)
 		get_widget(item->icon[large]));
 }
 
+static DebugState last_toolbar_state;
+
 static void toolbar_update_state(DebugState state)
 {
-	static DebugState last_state = 0;
 	state |= debug_menu_extra_state();
 
-	if (state != last_state)
+	if (state != last_toolbar_state)
 	{
 		ToolItem *item;
 
@@ -206,7 +207,7 @@ static void toolbar_update_state(DebugState state)
 				menu_item_matches_state(debug_menu_items + item->index, state));
 		}
 
-		state = last_state;
+		last_toolbar_state = state;
 	}
 }
 
@@ -214,14 +215,14 @@ static void toolbar_update_state(DebugState state)
 static GtkWidget *debug_statusbar;
 static GtkLabel *debug_state_label;
 
+static DebugState last_statusbar_state;
+ 
 void statusbar_update_state(DebugState state)
 {
-	static DebugState last_state = DS_INACTIVE;
-
 	if (thread_state == THREAD_AT_ASSEMBLER)
 		state = DS_EXTRA_1;
 
-	if (state != last_state)
+	if (state != last_statusbar_state)
 	{
 		static const char *const states[] = { N_("Busy"), N_("Ready"), N_("Debug"),
 			N_("Hang"), N_("Assem"), N_("Load"), NULL };
@@ -242,7 +243,7 @@ void statusbar_update_state(DebugState state)
 			gtk_statusbar_set_has_resize_grip(geany_statusbar, TRUE);
 		#endif
 		}
-		else if (last_state == DS_INACTIVE)
+		else if (last_statusbar_state == DS_INACTIVE)
 		{
 		#if GTK_CHECK_VERSION(3, 0, 0)
 			gtk_window_set_has_resize_grip(GTK_WINDOW(geany->main_widgets->window), FALSE);
@@ -252,11 +253,11 @@ void statusbar_update_state(DebugState state)
 			gtk_widget_show(debug_statusbar);
 		}
 
-		last_state = state;
+		last_statusbar_state = state;
 	}
 }
 
-static guint blink_id = 0;
+static guint blink_id;
 
 static gboolean plugin_unblink(G_GNUC_UNUSED gpointer gdata)
 {
@@ -312,7 +313,7 @@ static void on_document_open(G_GNUC_UNUSED GObject *obj, GeanyDocument *doc,
 		threads_mark(doc);
 }
 
-static guint resync_id = 0;
+static guint resync_id;
 
 static gboolean resync_readonly(G_GNUC_UNUSED gpointer gdata)
 {
@@ -439,7 +440,7 @@ static void on_build_start(G_GNUC_UNUSED GObject *obj, G_GNUC_UNUSED gpointer gd
 	{ NULL, NULL }
 };
 
-static GtkBuilder *builder = NULL;
+static GtkBuilder *builder;
 
 GObject *get_object(const char *name)
 {
@@ -513,6 +514,11 @@ void plugin_init(G_GNUC_UNUSED GeanyData *gdata)
 	ToolItem *tool_item = toolbar_items;
 	const ScopeCallback *scb;
 
+	last_toolbar_state = 0;
+	last_statusbar_state = DS_INACTIVE;
+	blink_id = 0;
+	resync_id = 0;
+
 	main_locale_init(LOCALEDIR, GETTEXT_PACKAGE);
 	scope_key_group = plugin_set_key_group(geany_plugin, "scope", COUNT_KB, NULL);
 	builder = gtk_builder_new();
@@ -573,6 +579,7 @@ void plugin_init(G_GNUC_UNUSED GeanyData *gdata)
 	conterm_init();
 	inspect_init();
 	register_init();
+	tooltip_init();
 	parse_init();
 	debug_init();
 	views_init();


Modified: scope/src/stack.c
4 files changed, 3 insertions(+), 1 deletions(-)
===================================================================
@@ -62,7 +62,7 @@ static void stack_node_location(const ParseNode *node, const char *fid)
 	}
 }
 
-const char *frame_id = NULL;
+const char *frame_id;
 
 void on_stack_frames(GArray *nodes)
 {
@@ -336,6 +336,8 @@ void stack_init(void)
 	GtkTreeView *tree = view_create("stack_view", &store, &selection);
 	GtkWidget *menu = menu_select("stack_menu", &stack_menu_info, selection);
 
+	frame_id = NULL;
+
 	view_set_sort_func(store, STACK_ID, store_gint_compare);
 	view_set_sort_func(store, STACK_FILE, store_seek_compare);
 	view_set_line_data_func("stack_line_column", "stack_line", STACK_LINE);


Modified: scope/src/store/scptreestore.c
10 files changed, 5 insertions(+), 5 deletions(-)
===================================================================
@@ -1059,7 +1059,7 @@ gboolean scp_tree_store_row_draggable(G_GNUC_UNUSED ScpTreeStore *store,
 {
 	return TRUE;
 }
-               
+
 gboolean scp_tree_store_drag_data_delete(ScpTreeStore *store, GtkTreePath *path)
 {
 	GtkTreeIter iter;
@@ -1123,9 +1123,9 @@ gboolean scp_tree_store_drag_data_received(ScpTreeStore *store, GtkTreePath *des
 	GtkTreePath *src_path = NULL;
 	GtkTreeIter src_iter;
 	gboolean result = FALSE;
-      
+
 	validate_store(store);
-      
+
 	if (gtk_tree_get_row_drag_data(selection_data, &src_model, &src_path) &&
 		src_model == SCP_TREE_MODEL(store) && /* can only receive from ourselves */
 		scp_tree_store_get_iter(store, &src_iter, src_path))
@@ -1189,7 +1189,7 @@ gboolean scp_tree_store_row_drop_possible(ScpTreeStore *store, GtkTreePath *dest
 			scp_tree_store_get_iter(store, &iter, parent_path);
 		gtk_tree_path_free(parent_path);
 	}
-  
+
 	if (src_path)
 		gtk_tree_path_free(src_path);
 
@@ -1437,7 +1437,7 @@ static gboolean scp_tree_store_buildable_custom_tag_start(GtkBuildable *buildabl
 		parser_data->name = gtk_buildable_get_name(buildable);
 		parser_data->types = g_array_new(FALSE, FALSE, sizeof(GType));
 		parser_data->collates = g_array_new(FALSE, FALSE, sizeof(gboolean));
- 		*parser = tree_model_parser;
+		*parser = tree_model_parser;
 		*user_data = parser_data;
 		return TRUE;
 	}


Modified: scope/src/thread.c
15 files changed, 10 insertions(+), 5 deletions(-)
===================================================================
@@ -38,7 +38,7 @@ enum
 	GROUP_PID
 };
 
-static ScpTreeStore *groups = NULL;
+static ScpTreeStore *groups;
 
 void on_thread_group_started(GArray *nodes)
 {
@@ -172,10 +172,10 @@ static void auto_select_thread(void)
 	}
 }
 
-guint thread_count = 0;
-const char *thread_id = NULL;
-ThreadState thread_state = THREAD_BLANK;
-guint thread_prompt = 0;
+guint thread_count;
+const char *thread_id;
+ThreadState thread_state;
+guint thread_prompt;
 
 const char *thread_group_id(void)
 {
@@ -876,6 +876,11 @@ void thread_init(void)
 	GtkTreeView *tree = view_create("thread_view", &store, &selection);
 	GtkWidget *menu = menu_select("thread_menu", &thread_menu_info, selection);
 
+	thread_count = 0;
+	thread_id = NULL;
+	thread_state = THREAD_BLANK;
+	thread_prompt = 0;
+
 	view_set_sort_func(store, THREAD_ID, store_gint_compare);
 	view_set_sort_func(store, THREAD_FILE, store_seek_compare);
 	view_set_line_data_func("thread_line_column", "thread_line", THREAD_LINE);


Modified: scope/src/tooltip.c
20 files changed, 14 insertions(+), 6 deletions(-)
===================================================================
@@ -48,9 +48,9 @@ static void tooltip_trigger(void)
 	}
 }
 
-static gchar *output = NULL;
-static gint last_pos = -1;
-static gint peek_pos = -1;
+static gchar *output;
+static gint last_pos;
+static gint peek_pos;
 static gboolean show;
 
 static void tooltip_set(gchar *text)
@@ -69,7 +69,7 @@ static void tooltip_set(gchar *text)
 	}
 }
 
-static gint scid_gen = 0;
+static gint scid_gen;
 
 void on_tooltip_error(GArray *nodes)
 {
@@ -86,7 +86,7 @@ void on_tooltip_error(GArray *nodes)
 	}
 }
 
-static char *input = NULL;
+static char *input;
 
 void on_tooltip_value(GArray *nodes)
 {
@@ -97,7 +97,7 @@ void on_tooltip_value(GArray *nodes)
 	}
 }
 
-static guint query_id = 0;
+static guint query_id;
 
 static gboolean tooltip_launch(gpointer gdata)
 {
@@ -200,6 +200,14 @@ gboolean tooltip_update(void)
 	return TRUE;
 }
 
+void tooltip_init(void)
+{
+	output = NULL;
+	tooltip_clear();
+	input = NULL;
+	query_id = 0;
+}
+
 void tooltip_finalize(void)
 {
 	g_free(output);


Modified: scope/src/tooltip.h
1 files changed, 1 insertions(+), 0 deletions(-)
===================================================================
@@ -28,6 +28,7 @@
 void tooltip_clear(void);
 gboolean tooltip_update(void);
 
+void tooltip_init(void);
 void tooltip_finalize(void);
 
 #define TOOLTIP_H 1


Modified: scope/src/views.c
17 files changed, 12 insertions(+), 5 deletions(-)
===================================================================
@@ -114,7 +114,7 @@ void views_context_dirty(DebugState state, gboolean frame_only)
 	}
 }
 
-static ViewIndex view_current = 0;
+static ViewIndex view_current;
 
 void views_clear(void)
 {
@@ -580,18 +580,18 @@ gboolean view_command_active(void)
 	return gtk_widget_get_visible(command_dialog);
 }
 
+static DebugState last_views_state;
+
 void views_update_state(DebugState state)
 {
-	static DebugState last_state = 0;
-
-	if (state != last_state)
+	if (state != last_views_state)
 	{
 		if (gtk_widget_get_visible(command_dialog))
 			command_line_update_state(state);
 		locals_update_state(state);
 		watches_update_state(state);
 		inspects_update_state(state);
-		last_state = state;
+		last_views_state = state;
 	}
 }
 
@@ -605,6 +605,13 @@ static void on_geany_sidebar_switch_page(G_GNUC_UNUSED GtkNotebook *notebook,
 
 void views_init(void)
 {
+#ifdef G_OS_UNIX
+	view_current = VIEW_TERMINAL;
+#else
+	view_current = VIEW_PROGRAM;
+#endif
+	last_views_state = 0;
+
 	command_dialog = dialog_connect("command_dialog");
 	command_view = get_widget("command_view");
 	command_text = gtk_text_view_get_buffer(GTK_TEXT_VIEW(command_view));



--------------
This E-Mail was brought to you by github_commit_mail.py (Source: https://github.com/geany/infrastructure).


More information about the Plugins-Commits mailing list