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 126721 - can not access elements of TreeView::get_columns()const
can not access elements of TreeView::get_columns()const
Status: RESOLVED FIXED
Product: gtkmm
Classification: Bindings
Component: TreeView
2.4
Other Linux
: Normal minor
: ---
Assigned To: gtkmm-forge
gtkmm-forge
Depends on:
Blocks:
 
 
Reported: 2003-11-11 12:51 UTC by Christof Petig
Modified: 2004-12-22 21:47 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
More elaborate test case which makes clear what I originally intended to do (234 bytes, text/x-csrc)
2003-11-12 14:15 UTC, Christof Petig
Details
Program which uses std::list for accessing treeview columns (only 1 line changed) (243 bytes, text/plain)
2003-11-17 09:52 UTC, Christof Petig
Details

Description Christof Petig 2003-11-11 12:51:21 UTC
Since I can not dereference the list elements, the get_columns()const is of
little value:

#include <gtkmm/treeview.h>

typedef Glib::ListHandle<const Gtk::TreeViewColumn*> list_t;

void f()
{  list_t *l=0;
   for (list_t::const_iterator x=l->begin();x!=l->end();++x)
        *x;
}

---------
# g++ -c x.cc `pkg-config --cflags gtkmm-2.0`

/usr/include/gtkmm-2.0/glibmm/containerhandle_shared.h: In static member 
   function `static const T* Glib::Container_Helpers::TypeTraits<const 
   T*>::to_cpp_type(typename T::BaseObjectType*) [with T = Gtk::TreeViewColumn]
   ':
/usr/include/gtkmm-2.0/glibmm/listhandle.h:227:   instantiated from
`typename Tr
::CppType Glib::Container_Helpers::ListHandleIterator<Tr>::operator*()
const [wi
th Tr = Glib::Container_Helpers::TypeTraits<const Gtk::TreeViewColumn*>]'
x.cc:8:   instantiated from here
/usr/include/gtkmm-2.0/glibmm/containerhandle_shared.h:162: error: invalid 
   conversion from `const GtkTreeViewColumn*' to `GtkTreeViewColumn*'
/usr/include/gtkmm-2.0/glibmm/containerhandle_shared.h:162: error:   
   initializing argument 1 of `Gtk::TreeViewColumn* 
   Glib::wrap(GtkTreeViewColumn*, bool)'

# pkg-config --modversion gtkmm-2.0
2.2.8
Comment 1 Murray Cumming 2003-11-12 13:18:58 UTC
Please see:
http://www.gtkmm.org/gtkmm2/docs/tutorial/html/ch03s05.html
and
http://www.gtkmm.org/gtkmm2/docs/reference/html/classGlib_1_1ListHandle.html

If this is still a problem after using a non-intermediate C++
container, please reopen this bug.
Comment 2 Christof Petig 2003-11-12 14:07:10 UTC
Sorry, I was not explicit enough. The problem is that this TreeView member

Glib::ListHandle<const TreeViewColumn*> get_columns() const;

returns exactly the type which causes the for loop to fail compiling.
So my problem is not with ListHandle per se (though the bug might lie
here) but with exactly the type get_columns returns.

I can't access any member of this ListHandle (due to constness errors).

The program above was the minimal code showing the problem (I did
never say that this is reasonable code).
Comment 3 Christof Petig 2003-11-12 14:15:43 UTC
Created attachment 21385 [details]
More elaborate test case which makes clear what I originally intended to do
Comment 4 Murray Cumming 2003-11-12 15:38:39 UTC
I don't get it - you are still using ListHandle in your test case. Do
you have a snippet of test case that use std::list or std::vector
instead? Maybe you're helping me to find the solution, but I don't see
the problem yet.
Comment 5 Murray Cumming 2003-11-14 22:44:27 UTC
I think maybe you uploaded the wrong test case by mistake.
Comment 6 Christof Petig 2003-11-17 09:49:57 UTC
I want is to access columns of a const TreeView.

But even if I use a std::list to access the elements (I did not know
that this was transparently possible neither do I see any benefits
now) the error stays the same:

/usr/include/gtkmm-2.0/glibmm/containerhandle_shared.h:162: error:
invalid 
   conversion from `const GtkTreeViewColumn*' to `GtkTreeViewColumn*'
/usr/include/gtkmm-2.0/glibmm/containerhandle_shared.h:162: error:   
   initializing argument 1 of `Gtk::TreeViewColumn* 
   Glib::wrap(GtkTreeViewColumn*, bool)'

------
Sample program modified by:
-typedef Glib::ListHandle<const Gtk::TreeViewColumn*> list_t;
+#include <list>
+typedef std::list<const Gtk::TreeViewColumn*> list_t;
(do I need to reattach it?)
Comment 7 Christof Petig 2003-11-17 09:52:46 UTC
Created attachment 21524 [details]
Program which uses std::list for accessing treeview columns (only 1 line changed)
Comment 8 Murray Cumming 2003-11-21 14:05:39 UTC
Thanks. Hopefully we can do something about this for 2.4.
Comment 9 Murray Cumming 2004-02-03 11:02:13 UTC
Fixed for 2.4 in cvs, including a fix in glibmm. Thanks. I fixed
similar methods too.
Comment 10 Mark McLoughlin 2004-03-31 06:17:37 UTC
*** Bug 138578 has been marked as a duplicate of this bug. ***
Comment 11 Mark McLoughlin 2004-03-31 06:17:53 UTC
*** Bug 138581 has been marked as a duplicate of this bug. ***