GNOME Bugzilla – Bug 559374
get_items_at shouldn't be const
Last modified: 2011-01-16 23:36:58 UTC
I try to create a new item implementing the interface Goocanvas::Item, but I can't find how to override get_items_at_vfunc correctly. When I try to add the current object (this) to the list of found items, the compiler complains about an invalid cast from "Goocanvas::Item* const" to "Goocanvas::Item*".
Created attachment 121990 [details] Test code You can compile with : g++ item.cpp -o item `pkg-config gtkmm-2.4 goocanvasmm-1.0 --cflags --libs`
Created attachment 121991 [details] Header file for test code
Created attachment 122045 [details] [review] Proposed patch This patch makes that vfunc non-const. This would break ABI, I think. Is goocanvasmm ABI stable? Even if, probably the get_items_at_vfunc could not have been used in a senseful way in the current form anyway.
Yes, it should not be const. Please apply. We are not really ABI stable. Where a vfunc would need 2 method overloads to do constness properly, we should just make it non-const.
2008-11-05 Armin Burgmeier <armin@openismus.com> * goocanvas/src/item.hg: * goocanvas/src/item.ccg: Remove the const qualifier for the get_items_at_vfunc, because otherwise the item itself cannot be added to the returned list of items. Bug #559374 (Louis-Francis Ratté-Boulianne)