TreeView Question: how does one use TreeModelColumn<enum MyEnum>
- From: Edward Leaver <eleaver sterlingseismic com>
- To: gtkmm mailing list <gtkmm-list gnome org>
- Subject: TreeView Question: how does one use TreeModelColumn<enum MyEnum>
- Date: Fri, 04 Aug 2006 03:56:39 -0600
Here's what I would like to do:
-------------------------------------------------------
enum Checksum_t {NONE, ADLER32, CRC32, MD5};
class C_Columns : public Gtk::TreeModel::ColumnRecord {
public:
Gtk::TreeModelColumn<Checksum_t> m_chksum_type;
C_Columns(){
add(m_chksum_type);
};
};
-----------------------------------------------------------------------
I run into a segfault when I try to assign a value e.g.
C_Columns Columns;
Checksum_t val = ADLER32;
Glib::RefPtr<Gtk::TreeStore> refSelectedTreeStore;
refSelectedTreeStore.clear();
refSelectedTreeStore = Gtk::TreeStore::create(Columns);
const Gtk::TreeIter & row_iter = refSelectedTreeStore->append();
(*row_iter)[Columns.m_chksum_type] = val; // segfault
---------------------------------------------------------------------
gdb tells me the bad news
from /usr/include/glibmm-2.4/glibmm/value_custom.h:237:
template <class T> inline
void Value<T>::set(const typename Value<T>::CppType& data)
{
// Assume the value is already default-initialized. See
value_init_func().
=> *static_cast<T*>(gobject_.data[0].v_pointer) = data;
}
(gdb) print gobject_
$1 = {g_type = 0, data = {{v_int = 0, v_uint = 0, v_long = 0, v_ulong =
0, v_int64 = 0, v_uint64 = 0, v_float = 0, v_double = 0, v_pointer =
0x0}, {v_int = 0, v_uint = 0, v_long = 0, v_ulong = 0, v_int64 = 0,
v_uint64 = 0, v_float = 0, v_double = 0, v_pointer = 0x0}}}
--------------------------------------------------------------------
I.e., the underlying gobject_'s data[] vector hasn't been initialized
(value_init_func() probably hasn't been called).
Enumeration types are the only data types I've difficulty with: all the
other usual built-in C-types are fine, as are "proper" C++ objects.
I'm running a default CentOS 4.3 installation, gtkmm-2.4, gcc 3.4.5.
Does anyone have any suggestions?
Thanks!
Ed Leaver
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]