Re: seg fault creating a column to append to a treeview



You state the cited code works in another application where the only difference between the two is that the non seg faulting application "is the main window graphic interface done with glade", yet the gdb output from the seg-faulthing application makes reference to Glade in its last line of output. I would guess that, even though the value of m_ptvConnections is not NULL at runtime, it has not been properly initialized.
Bob

Angelo Dureghello wrote:
hi all,

i'm quite new to gtkmm-2.4, i receive a seg fault creating a column to append to a treeview. This is the involved code:

on .h:

class WndMain : public Gtk::Window
{
    ....

 typedef Glib::RefPtr<Gdk::Pixbuf> refpix;
 typedef Glib::RefPtr<Gtk::ListStore> reflst;
 class ModelColumns : public Gtk::TreeModelColumnRecord
   {
   public:
      ModelColumns()
      {
            add(m_colState);
            add(m_colIcon);
         add(m_colSignature);
         add(m_colSerial);
      }
        Gtk::TreeModelColumn<int>                m_colState;
        Gtk::TreeModelColumn<refpix>            m_colIcon;
      Gtk::TreeModelColumn<Glib::ustring>    m_colSignature;
      Gtk::TreeModelColumn<Glib::ustring>    m_colSerial;
   };

    reflst                    m_rListStore;
    Gtk::TreeView          *m_ptvConnections;

    const ModelColumns   m_Columns;
    ...
};

on cpp:

    ....

    if (m_ptvConnections)
    {
      m_rListStore = Gtk::ListStore::create(m_Columns);
      m_ptvConnections->set_model(m_rListStore);


m_ptvConnections->append_column("test", m_Columns.m_colState); <-- this give seg fault
    }


Same code is working in another application, where the only difference is the main window graphic interface done with glade.
Gdb is telling these informations:

Gtk::Object::Object (this=0x2876158,__vtt_parm=0x45891c,construct_params= 0x22fb60) object.cc 214 Gtk::Object::Object (this=0x2876158,__vtt_parm=0x458918,construct_params= 0x22fb60) object.cc 35
_fu1____ZTTN3Gtk14TreeViewColumnE   ()
Gtk::TreeView::append_column<int> (this=0x28759f0, title= 0x22fce0,model_column= 0x28757e4))
WndMain::WndMain    (this=0x28759f0,cobject=0x279a0e0,refGlade= 0x22fde0)


If any help, many thanks, Angelo



_______________________________________________
gtkmm-list mailing list
gtkmm-list gnome org
http://mail.gnome.org/mailman/listinfo/gtkmm-list






[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]