]> git.ipfire.org Git - thirdparty/mtr.git/commitdiff
crash fix: add ctl structure to gtk Pause_clicked() handler
authorSami Kerola <kerolasa@iki.fi>
Sat, 3 Sep 2016 22:25:17 +0000 (23:25 +0100)
committerSami Kerola <kerolasa@iki.fi>
Sun, 4 Sep 2016 16:02:59 +0000 (17:02 +0100)
Without this handler net_max() will crash with SIGSEGV at line 1209.  gdb
backtrace gave clear hint what was the problem, and where it needs to be
fixed.

  #0 0x4109db in net_max /home/src/mtr/net.c:1209
  #1 0x42478e in gtk_redraw /home/src/mtr/gtk.c:508
  #2 0x422fc7 in Pause_clicked /home/src/mtr/gtk.c:121

gtk.c

diff --git a/gtk.c b/gtk.c
index e7f71afa437fe869b4c60286fc50f6025ff067b2..1d730c3025f76618b8597cf9d68cf4a5f3328503 100644 (file)
--- a/gtk.c
+++ b/gtk.c
@@ -259,7 +259,7 @@ static void Toolbar_fill(struct mtr_ctl *ctl, GtkWidget *Toolbar)
   Pause_Button = gtk_toggle_button_new_with_mnemonic("_Pause");
   gtk_box_pack_end(GTK_BOX(Toolbar), Pause_Button, FALSE, FALSE, 0);
   g_signal_connect(GTK_OBJECT(Pause_Button), "clicked",
-                    GTK_SIGNAL_FUNC(Pause_clicked), NULL);
+                    GTK_SIGNAL_FUNC(Pause_clicked), ctl);
 
   /* allow root only to set zero delay */
   Adjustment = (GtkAdjustment *)gtk_adjustment_new(ctl->WaitTime,