Gtkmm3 help - segmentation fault

I am desperately trying to create a simple GUI using gtkmm3 on the raspberry pi and have been struggling with this for too long. However, when I run the program, I seem to get a segmentation fault and I have no idea why..If I take out the last row on the grid, it works. Is there something I am doing a wrong or a better approach?

Here's the header file, gui_ex.h:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
    #ifndef GTKMM_EX_GUI_H
    #define GTKMM_EX_GUI_H
    
    #include <gtkmm.h>
    
    class Gui_Ex : public Gtk::Window
    {
    public:
    	Gui_Ex();
    	virtual ~Gui_Ex();
     
    protected:
    	// Signal handlers:
    	void on_connect_click();  
        void on_quit();
      
    
    	//child widgets
      Glib::RefPtr<Gtk::Adjustment> m_adjustment;
      Gtk::Box m_VBox;
      Gtk::Label m_label, m_label2, m_label3;
      Gtk::Grid m_grid;
      Gtk::SpinButton m_spin;
      Gtk::Button m_button3, m_button4;//, m_connect;
      
        
    };
    
    #endif // GTKMM_EX_GUI_H 


gui_ex.cpp:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
    #include "gui_ex.h"
    Gui_Ex::Gui_Ex()
    :
       m_adjustment( Gtk::Adjustment::create(1.0, 1.0, 5.0, 1.0, 5.0, 0.0) ),
       m_VBox(Gtk::ORIENTATION_VERTICAL), 
       
       m_label2("label2"),
       m_label3("label3"),
       m_button3("Connect"),
       m_button4("Quit"),
       m_spin(m_adjustment),  
       m_label("Choose the number of clients")  
    {
    	set_title("Grid");
      set_border_width(16);
    
      add(m_VBox);
      
    
      m_VBox.pack_start(m_grid);
      m_grid.attach(m_label, 0,0,2,1); //column, row, width (# col span), height (# row span). starts at 0
      m_grid.attach(m_spin, 2,0,1,1);
      m_grid.attach(m_label2, 0,1,2,1);
      m_grid.attach(m_label3, 2,1,1,1);
      m_grid.attach(m_button3, 0,2,2,1);
      m_grid.attach(m_button4, 2,2,1,1);
      
      m_spin.set_wrap();
      m_spin.set_numeric(true);
           
      m_button3.set_sensitive(true);
      m_button4.set_sensitive(false);  
      
      m_button3.signal_clicked().connect(sigc::mem_fun(*this, &Gui_Ex::on_connect_click));
      m_button4.signal_clicked().connect(sigc::mem_fun(*this, &Gui_Ex::on_quit));  
     
     
      show_all_children();
     
    }
    
    Gui_Ex::~Gui_Ex()
    {
    }
    
    void Gui_Ex::on_quit(){
      bool running = false;
      m_spin.set_sensitive(true);
      
     m_button3.set_sensitive(true);
      
    }
    
    
    void Gui_Ex::on_connect_click()
    {
        int BACKLOG = m_spin.get_value_as_int();
        m_spin.set_sensitive(false);
        m_button4.set_sensitive(true);
    }


Put the code you need help with here.
Topic archived. No new replies allowed.