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 108971 - Deriving from Glib::Object produces debug spew
Deriving from Glib::Object produces debug spew
Status: RESOLVED FIXED
Product: gtkmm
Classification: Bindings
Component: general
2.4
Other Linux
: Low trivial
: ---
Assigned To: gtkmm-forge
gtkmm-forge
Depends on:
Blocks:
 
 
Reported: 2003-03-22 20:51 UTC by Seth Nickell
Modified: 2004-12-22 21:47 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Seth Nickell 2003-03-22 20:51:54 UTC
I'm trying to derive from Glib::Object, but in object.cc we find:

Object::Object()
{
  // This constructor is ONLY for derived classes that are NOT wrappers of
  // derived C objects.  For instance, Gtk::Object should NOT use this
  // constructor.  TODO: Remove the g_warning()
  g_warning("Object::Object(): Did you really mean to call this?");
  ...

Which makes my program produce tons of unnecessary (and not really
accurate) debug output. Just making sure the TODO doesn't get forgotten :-)
Comment 1 Murray Cumming 2003-03-24 17:25:19 UTC
OK. By the way, why did you want to derive from Glib::Object?
Comment 2 Seth Nickell 2003-03-25 22:31:37 UTC
I'm trying to integrate my code with an existing C API (actually, my
own, which I'm planning to gradually convert to C++) that takes a GObject.
Comment 3 Murray Cumming 2003-03-26 08:53:26 UTC
If you really need to implement a new GType then it might be worth
looking at examples of custom TreeModels (one of the Dnd examples, I
think) and CellRenderers (the customcellrenderer example). But it's
probably best not to depend on GTypes if you can help it. 
Comment 4 Murray Cumming 2003-04-01 17:52:06 UTC
I think we need to find an example of when this is actually a good
idea before we remove that g_warning. I suspect that Daniel has an
opinion about this.
Comment 5 Murray Cumming 2003-07-16 15:29:56 UTC
At the least we should put a bit more information in that warning,
such as "You probably have no reason to derive directly from
Glib::Object."
Comment 6 Murray Cumming 2004-01-12 22:15:40 UTC
This has been fixed as part of bug #124297. The Glib::Object default
constructor is now known to be useful for implementing custom
TreeModels, because they need a GType.