Re: [gtkmm] Problem with TreeModelColumn types
- From: Roger Leigh <roger whinlatter uklinux net>
- To: gtkmm-list gnome org
- Subject: Re: [gtkmm] Problem with TreeModelColumn types
- Date: Thu, 13 May 2004 19:08:10 +0100
Johannes Wolter <Johannes Wolter epost de> writes:
> When I set a column-value in a row and read the same value everything
> works fine:
>
> row[categoryTreeColumns->catFields] =
> CategoryFields::getCategoryFields(rootCategory.cat_fields);
> std::vector<CategoryField> catFields =
> row[categoryTreeColumns->catFields];
>
> But when I try to access the same value in the same row afterwards I get
> a segfault:
>
> Glib::RefPtr<Gtk::TreeSelection> selection =
> categoriesTreeView->get_selection();
You haven't made sure the selection is valid:
if (selection->get_model().is_null() == false &&
selection->count_selected_rows() > 0)
{
> const Gtk::TreeRow &selectedRow =
> *(selection->get_selected());
> std::vector<CategoryField> catFields =
> selectedRow[categoryTreeColumns->catFields];
}
else
{
// there is no model, or no rows are selected
}
--
Roger Leigh
Printing on GNU/Linux? http://gimp-print.sourceforge.net/
GPG Public Key: 0x25BFB848. Please sign and encrypt your mail.
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]