Commit 1c65586e44fd60bed71752c267cd8454fe8a607a

Authored by Perry Werneck
1 parent 5c269dc4
Exists in master and in 1 other branch develop

Delaying "has_timer" signal to avoid thread issues.

Showing 1 changed file with 23 additions and 3 deletions   Show diff stats
src/terminal/callbacks.c
@@ -47,15 +47,35 @@ @@ -47,15 +47,35 @@
47 47
48 /*--[ Implement ]------------------------------------------------------------------------------------*/ 48 /*--[ Implement ]------------------------------------------------------------------------------------*/
49 49
50 -static void set_timer(H3270 *session, unsigned char on) 50 +struct has_timer
51 { 51 {
52 - GtkWidget *widget = GTK_WIDGET(lib3270_get_user_data(session)); 52 + H3270 * hSession;
  53 + unsigned char on;
  54 +};
53 55
54 - if(on) 56 +static gboolean bg_has_timer(struct has_timer *data)
  57 +{
  58 + GtkWidget *widget = GTK_WIDGET(lib3270_get_user_data(data->hSession));
  59 +
  60 + if(data->on)
55 v3270_start_timer(widget); 61 v3270_start_timer(widget);
56 else 62 else
57 v3270_stop_timer(widget); 63 v3270_stop_timer(widget);
58 64
  65 + g_free(data);
  66 +
  67 + return FALSE;
  68 +}
  69 +
  70 +static void set_timer(H3270 *session, unsigned char on)
  71 +{
  72 + struct has_timer *data = g_malloc0(sizeof(struct has_timer));
  73 +
  74 + data->hSession = session;
  75 + data->on = on;
  76 +
  77 + g_idle_add((GSourceFunc) bg_has_timer, data);
  78 +
59 } 79 }
60 80
61 static void update_toggle(H3270 *session, LIB3270_TOGGLE_ID id, unsigned char value, G_GNUC_UNUSED LIB3270_TOGGLE_TYPE reason, const char *name) 81 static void update_toggle(H3270 *session, LIB3270_TOGGLE_ID id, unsigned char value, G_GNUC_UNUSED LIB3270_TOGGLE_TYPE reason, const char *name)