Commit 52974d23724c2c55575e0e4cd3b269a9f9a3ca5f

Authored by Perry Werneck
1 parent 78d5bf07
Exists in master and in 1 other branch develop

Adjustments to find why the trace windows segfaults on release packages.

Showing 1 changed file with 24 additions and 15 deletions   Show diff stats
src/trace/trace.c
@@ -115,7 +115,14 @@ @@ -115,7 +115,14 @@
115 debug("%s: Session changes %p -> %p", __FUNCTION__, widget->hSession, hSession); 115 debug("%s: Session changes %p -> %p", __FUNCTION__, widget->hSession, hSession);
116 116
117 if(widget->hSession) { 117 if(widget->hSession) {
  118 +
  119 + debug("Disconnecting from session %p",widget->hSession);
  120 +
118 lib3270_set_trace_handler(widget->hSession,widget->trace.handler,widget->trace.userdata); 121 lib3270_set_trace_handler(widget->hSession,widget->trace.handler,widget->trace.userdata);
  122 +
  123 + size_t ix;
  124 + for(ix=0;ix < G_N_ELEMENTS(toggles); ix++)
  125 + lib3270_set_toggle(widget->hSession, toggles[ix],0);
119 } 126 }
120 127
121 widget->hSession = hSession; 128 widget->hSession = hSession;
@@ -128,7 +135,10 @@ @@ -128,7 +135,10 @@
128 // v3270_toggle_button_set_session 135 // v3270_toggle_button_set_session
129 size_t ix; 136 size_t ix;
130 for(ix = 0; ix < G_N_ELEMENTS(toggles); ix++) 137 for(ix = 0; ix < G_N_ELEMENTS(toggles); ix++)
131 - v3270_toggle_button_set_session(widget->buttons.widgets[ix],hSession); 138 + {
  139 + if(widget->buttons.widgets[ix])
  140 + v3270_toggle_button_set_session(widget->buttons.widgets[ix],hSession);
  141 + }
132 142
133 143
134 } 144 }
@@ -139,6 +149,13 @@ @@ -139,6 +149,13 @@
139 149
140 V3270Trace *trace = GTK_V3270_TRACE(object); 150 V3270Trace *trace = GTK_V3270_TRACE(object);
141 151
  152 + size_t ix;
  153 + for(ix = 0; ix < G_N_ELEMENTS(toggles); ix++)
  154 + {
  155 + // TODO: Use button "destroy" signal to cleanup.
  156 + trace->buttons.widgets[ix] = NULL;
  157 + }
  158 +
142 if(trace->filename) { 159 if(trace->filename) {
143 g_free(trace->filename); 160 g_free(trace->filename);
144 trace->filename = NULL; 161 trace->filename = NULL;
@@ -165,18 +182,7 @@ @@ -165,18 +182,7 @@
165 GTK_V3270(trace->terminal)->trace = NULL; 182 GTK_V3270(trace->terminal)->trace = NULL;
166 } 183 }
167 184
168 - if(trace->hSession) {  
169 -  
170 - g_message("Disabling lib3270 traces");  
171 -  
172 - size_t ix;  
173 - for(ix=0;ix < G_N_ELEMENTS(toggles); ix++)  
174 - lib3270_set_toggle(trace->hSession, toggles[ix],0);  
175 -  
176 - lib3270_set_trace_handler(trace->hSession,trace->trace.handler,trace->trace.userdata);  
177 - trace->hSession = NULL;  
178 -  
179 - } 185 + set_session(trace,NULL);
180 186
181 g_clear_object(&trace->terminal); 187 g_clear_object(&trace->terminal);
182 188
@@ -426,10 +432,13 @@ @@ -426,10 +432,13 @@
426 GTK_V3270_GET_CLASS(terminal)->properties.trace 432 GTK_V3270_GET_CLASS(terminal)->properties.trace
427 ); 433 );
428 434
  435 + const gchar * lib3270_release = lib3270_get_build_rpq_timestamp();
  436 + const gchar * libv3270_release = G_STRINGIFY(RPQ_TIMESTAMP);
  437 +
429 g_autofree gchar * release = 438 g_autofree gchar * release =
430 g_strconcat( G_STRINGIFY(PRODUCT_NAME) " Revisions ", 439 g_strconcat( G_STRINGIFY(PRODUCT_NAME) " Revisions ",
431 - lib3270_get_build_rpq_timestamp(),  
432 - " " G_STRINGIFY(RPQ_TIMESTAMP) "\n\n", 440 + lib3270_release,
  441 + " ", libv3270_release, "\n\n",
433 NULL 442 NULL
434 ); 443 );
435 444