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



Caryl, many thanks,

i've solved the problem, and was really  hard to be solved.
It was not related to a bad gtkmm/glade use. I try to explain for all the users that could income in this issue.

For this project, i'm workig in windows with dev/cpp and mingw. My problem was that i was linking some libraries with my project, and one of these libraries was a msvc (.lib) library. Mixing on the linking step some libxx.a gnu libraries with a msvc library (xxx.lib) will give really strange behaviour on the application execution. In my particular case, i was getting a segmentation fault on a perfect gtkmm code, in the "Gtk::treeView::append_column(..." line, as from a tutorial.

So libxxx.a and  xxx.lib must never be mixed on the link step.

Thanks to all for the support,

Angelo Dureghello


Robert Caryl ha scritto:

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]