Commit 38f972dce58a90c82700c2d64c19ac8bc290d0ec

Authored by Perry Werneck
1 parent 8ab1afaf

Fixing segfault on multiple session files.

Showing 1 changed file with 9 additions and 3 deletions   Show diff stats
src/objects/application/open.c
@@ -71,9 +71,10 @@ @@ -71,9 +71,10 @@
71 void pw3270_application_open(GApplication *application, GFile **files, gint n_files, const gchar G_GNUC_UNUSED(*hint)) { 71 void pw3270_application_open(GApplication *application, GFile **files, gint n_files, const gchar G_GNUC_UNUSED(*hint)) {
72 72
73 GtkWidget * window = GTK_WIDGET(gtk_application_get_active_window(GTK_APPLICATION(application))); 73 GtkWidget * window = GTK_WIDGET(gtk_application_get_active_window(GTK_APPLICATION(application)));
74 - size_t path, subdir;  
75 gint file; 74 gint file;
76 75
  76 + debug("%s files=%d",__FUNCTION__,n_files);
  77 +
77 for(file = 0; file < n_files; file++) { 78 for(file = 0; file < n_files; file++) {
78 79
79 g_autofree gchar *path = g_file_get_path(files[file]); 80 g_autofree gchar *path = g_file_get_path(files[file]);
@@ -102,11 +103,14 @@ @@ -102,11 +103,14 @@
102 if(g_file_test(path,G_FILE_TEST_IS_REGULAR)) { 103 if(g_file_test(path,G_FILE_TEST_IS_REGULAR)) {
103 104
104 // The file exists, use it. 105 // The file exists, use it.
  106 + debug("%s: Loading '%s'",__FUNCTION__,path);
105 107
106 if(!window) { 108 if(!window) {
  109 + debug("%s: Creating new window",__FUNCTION__);
107 window = pw3270_application_window_new(GTK_APPLICATION(application), path); 110 window = pw3270_application_window_new(GTK_APPLICATION(application), path);
108 } else { 111 } else {
109 - window = pw3270_application_window_new_tab(window,path); 112 + debug("%s: Creating new tab",__FUNCTION__);
  113 + pw3270_application_window_new_tab(window,path);
110 } 114 }
111 115
112 continue; 116 continue;
@@ -119,9 +123,11 @@ @@ -119,9 +123,11 @@
119 if(filename) { 123 if(filename) {
120 124
121 if(!window) { 125 if(!window) {
  126 + debug("%s: Creating new window",__FUNCTION__);
122 window = pw3270_application_window_new(GTK_APPLICATION(application), filename); 127 window = pw3270_application_window_new(GTK_APPLICATION(application), filename);
123 } else { 128 } else {
124 - window = pw3270_application_window_new_tab(window, filename); 129 + debug("%s: Creating new tab",__FUNCTION__);
  130 + pw3270_application_window_new_tab(window, filename);
125 } 131 }
126 132
127 continue; 133 continue;