Fix bugs in closing gds render windows
This commit is contained in:
parent
28734a797a
commit
19b26a3c26
@ -74,15 +74,10 @@ static gboolean on_window_close(gpointer window, GdkEvent *event, gpointer user)
|
||||
if (!self)
|
||||
return TRUE;
|
||||
|
||||
g_clear_object(&self->main_window);
|
||||
g_clear_object(&self->cell_tree_view);
|
||||
g_clear_object(&self->convert_button);
|
||||
g_clear_object(&self->layer_selector);
|
||||
g_clear_object(&self->cell_tree_store);
|
||||
g_clear_object(&self->cell_search_entry);
|
||||
|
||||
/* Close Window. Leads to termination of the program/the current instance */
|
||||
g_clear_object(&self->main_window);
|
||||
gtk_widget_destroy(GTK_WIDGET(window));
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@ -429,17 +424,19 @@ static void gds_render_gui_dispose(GObject *gobject)
|
||||
|
||||
self = RENDERER_GUI(gobject);
|
||||
|
||||
if (self->main_window) {
|
||||
gtk_window_close(self->main_window);
|
||||
}
|
||||
|
||||
g_clear_object(&self->main_window);
|
||||
g_clear_object(&self->cell_tree_view);
|
||||
g_clear_object(&self->convert_button);
|
||||
g_clear_object(&self->layer_selector);
|
||||
g_clear_object(&self->cell_tree_store);
|
||||
g_clear_object(&self->cell_search_entry);
|
||||
|
||||
|
||||
if (self->main_window) {
|
||||
g_signal_handlers_destroy(self->main_window);
|
||||
gtk_widget_destroy(GTK_WIDGET(self->main_window));
|
||||
self->main_window = NULL;
|
||||
}
|
||||
|
||||
/* Chain up */
|
||||
G_OBJECT_CLASS(gds_render_gui_parent_class)->dispose(gobject);
|
||||
}
|
||||
|
9
main.c
9
main.c
@ -32,7 +32,7 @@ struct application_data {
|
||||
|
||||
static void app_quit(GSimpleAction *action, GVariant *parameter, gpointer user_data)
|
||||
{
|
||||
const struct application_data * const appdata = (const struct application_data *)user_data;
|
||||
struct application_data * const appdata = (struct application_data *)user_data;
|
||||
(void)action;
|
||||
(void)parameter;
|
||||
GList *list_iter;
|
||||
@ -45,6 +45,7 @@ static void app_quit(GSimpleAction *action, GVariant *parameter, gpointer user_d
|
||||
}
|
||||
|
||||
g_list_free(appdata->gui_list);
|
||||
appdata->gui_list = NULL;
|
||||
}
|
||||
|
||||
static void app_about(GSimpleAction *action, GVariant *parameter, gpointer user_data)
|
||||
@ -102,6 +103,12 @@ static int start_gui(int argc, char **argv)
|
||||
g_application_register(G_APPLICATION(gapp), NULL, NULL);
|
||||
g_signal_connect(gapp, "activate", G_CALLBACK(gapp_activate), &appdata);
|
||||
|
||||
if (g_application_get_is_remote(G_APPLICATION(gapp)) == TRUE) {
|
||||
g_application_activate(G_APPLICATION(gapp));
|
||||
printf("There is already an open instance. Will open second window in said instance.\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
menu = g_menu_new();
|
||||
m_quit = g_menu_new();
|
||||
m_about = g_menu_new();
|
||||
|
Loading…
Reference in New Issue
Block a user