Re: Segfault on Gtk::ListStore::clear ()

Kjell Ahlstedt via gtkmm-list <[email protected]> Wed, 2 Dec 2020 18:27:17 +0100
Newsgroups gmane.comp.gnome.gtkmm
Message-ID <[email protected]>
I added some code to one of the example programs in gtkmm-tutorial,
https://gitlab.gnome.org/GNOME/gtkmm-documentation/-/tree/gtkmm-3-24/examples/book/combobox/complex

ExampleWindow::~ExampleWindow()
{
   Gtk::TreeIter iList = m_refTreeModel->get_iter("0");
   while (iList)
   {
     std::cout << (*iList)[m_Columns.m_col_name] << std::endl;
     ++iList;
   }
   m_refTreeModel->clear();
}

No segfault!

You should use a debugger, such as gdb, to find out where the segfault 
is generated.

/Kjell

On 2020-12-01 17:27, Phil Wolff via gtkmm-list wrote:
> Consider this Gtk::ListStore (in a Gtk::ComboBox, if that matters):
>
>             Gtk::TreeIter iList = m_refServModel->get_iter( "0" );
>             while ( iList ) {
>                 std::cout << (*iList)[m_cServings.m_sStdServ] << 
> std::endl;
>                 ++iList;
>             }
>             m_refServModel->clear ();
>
> The while() loop correctly displays the several items in the list, but 
> the clear() generates a segfault.
>
> Any insight would be appreciated!
>
_______________________________________________
gtkmm-list mailing list
[email protected]
https://mail.gnome.org/mailman/listinfo/gtkmm-list