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 71 void pw3270_application_open(GApplication *application, GFile **files, gint n_files, const gchar G_GNUC_UNUSED(*hint)) {
72 72  
73 73 GtkWidget * window = GTK_WIDGET(gtk_application_get_active_window(GTK_APPLICATION(application)));
74   - size_t path, subdir;
75 74 gint file;
76 75  
  76 + debug("%s files=%d",__FUNCTION__,n_files);
  77 +
77 78 for(file = 0; file < n_files; file++) {
78 79  
79 80 g_autofree gchar *path = g_file_get_path(files[file]);
... ... @@ -102,11 +103,14 @@
102 103 if(g_file_test(path,G_FILE_TEST_IS_REGULAR)) {
103 104  
104 105 // The file exists, use it.
  106 + debug("%s: Loading '%s'",__FUNCTION__,path);
105 107  
106 108 if(!window) {
  109 + debug("%s: Creating new window",__FUNCTION__);
107 110 window = pw3270_application_window_new(GTK_APPLICATION(application), path);
108 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 116 continue;
... ... @@ -119,9 +123,11 @@
119 123 if(filename) {
120 124  
121 125 if(!window) {
  126 + debug("%s: Creating new window",__FUNCTION__);
122 127 window = pw3270_application_window_new(GTK_APPLICATION(application), filename);
123 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 133 continue;
... ...