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 559374 - get_items_at shouldn't be const
get_items_at shouldn't be const
Status: RESOLVED FIXED
Product: goocanvasmm
Classification: Other
Component: general
git master
Other Linux
: Normal normal
: ---
Assigned To: gtkmm-forge
Depends on:
Blocks:
 
 
Reported: 2008-11-05 04:50 UTC by Louis-Francis Ratté-Boulianne
Modified: 2011-01-16 23:36 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Test code (2.30 KB, text/x-c++src)
2008-11-05 04:51 UTC, Louis-Francis Ratté-Boulianne
  Details
Header file for test code (1.95 KB, text/x-chdr)
2008-11-05 04:52 UTC, Louis-Francis Ratté-Boulianne
  Details
Proposed patch (2.17 KB, patch)
2008-11-05 18:49 UTC, Armin Burgmeier
committed Details | Review

Description Louis-Francis Ratté-Boulianne 2008-11-05 04:50:18 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*".
Comment 1 Louis-Francis Ratté-Boulianne 2008-11-05 04:51:39 UTC
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`
Comment 2 Louis-Francis Ratté-Boulianne 2008-11-05 04:52:01 UTC
Created attachment 121991 [details]
Header file for test code
Comment 3 Armin Burgmeier 2008-11-05 18:49:19 UTC
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.
Comment 4 Murray Cumming 2008-11-06 17:01:06 UTC
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.
Comment 5 Armin Burgmeier 2008-11-06 17:14:41 UTC
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)