After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 99035 - list_store.clear() followed by list_store.append() segfaults
list_store.clear() followed by list_store.append() segfaults
Status: RESOLVED NOTABUG
Product: gtkmm
Classification: Bindings
Component: TreeView
2.0
Other other
: Normal normal
: ---
Assigned To: gtkmm-forge
gtkmm-forge
Depends on:
Blocks:
 
 
Reported: 2002-11-19 21:34 UTC by Ole Laursen
Modified: 2004-12-22 21:47 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Ole Laursen 2002-11-19 21:34:30 UTC
Modify the example under examples/book/treeview/list/examplewindow.cc to
clear the list before appending rows:

  //Create the Tree model:
  m_refTreeModel = Gtk::ListStore::create(m_Columns);
  m_TreeView.set_model(m_refTreeModel);

+ m_refTreeModel.clear();
+  
  //Fill the TreeView's model
  Gtk::TreeModel::Row row = *(m_refTreeModel->append());
  row[m_Columns.m_col_id] = 1;
  row[m_Columns.m_col_name] = "Billy Bob";

Then the append causes a segmentation fault. I got this with my own
program, too. This is with gtkmm 2.0.0.

I've tried modifying the paned.c example from GTK+ to include the line
"gtk_list_store_clear(model);", which works. So it's probably not a GTK+ bug.
Comment 1 Daniel Elstner 2002-11-19 23:56:11 UTC
Hmm,

    m_refTreeModel.clear();

invokes Glib::RefPtr<Gtk::ListStore>::clear(), which unreferences the
object and unsets the pointer :)

Cheers,
--Daniel
Comment 2 Ole Laursen 2002-11-20 20:28:29 UTC
Argh. Note to self: never mix copy-paste of code with typedefs that
prevent you from seeing what kind of types you're working with. Sorry.