开发者

What does "GLib-GObject-WARNING **: instance with invalid (NULL) class pointer" mean?

Whenever I close my Gtk# application, I get this:

(/home/matthew/opensbs/OpenSBS/bin/Debug/OpenSBS.exe:5050): GLib-WARNING **: g_set_prgname() called multiple times

(/home/matthew/opensbs/OpenSBS/bin/Debug/OpenSBS.exe:5050): GLib-GObject-WARNING **: instance with invalid (NULL) class pointer

(/home/matthew/opensbs/OpenSBS/bin/Debug/OpenSBS.exe:5050开发者_如何学Go): GLib-GObject-CRITICAL **: g_signal_handlers_disconnect_matched: assertion `G_TYPE_CHECK_INSTANCE (instance)' failed

(/home/matthew/opensbs/OpenSBS/bin/Debug/OpenSBS.exe:5050): GLib-GObject-WARNING **: instance with invalid (NULL) class pointer

(/home/matthew/opensbs/OpenSBS/bin/Debug/OpenSBS.exe:5050): GLib-GObject-CRITICAL **: g_signal_handlers_disconnect_matched: assertion `G_TYPE_CHECK_INSTANCE (instance)' failed

(/home/matthew/opensbs/OpenSBS/bin/Debug/OpenSBS.exe:5050): GLib-GObject-WARNING **: instance with invalid (NULL) class pointer

(/home/matthew/opensbs/OpenSBS/bin/Debug/OpenSBS.exe:5050): GLib-GObject-CRITICAL **: g_signal_handlers_disconnect_matched: assertion `G_TYPE_CHECK_INSTANCE (instance)' failed

(/home/matthew/opensbs/OpenSBS/bin/Debug/OpenSBS.exe:5050): GLib-GObject-WARNING **: instance with invalid (NULL) class pointer

(/home/matthew/opensbs/OpenSBS/bin/Debug/OpenSBS.exe:5050): GLib-GObject-CRITICAL **: g_signal_handlers_disconnect_matched: assertion `G_TYPE_CHECK_INSTANCE (instance)' failed

(/home/matthew/opensbs/OpenSBS/bin/Debug/OpenSBS.exe:5050): GLib-GObject-CRITICAL **: g_object_ref: assertion `object->ref_count > 0' failed

I'm not really sure what's going on here. I found one person with a similar problem on google, but they seemed to be a user of an application, not a developer. An ideas?


Something's pretty messed-up.

g_set_prgname() is an internal routine that's normally only called by a program initializer like gdk_init() or gtk_init() (which calls gdk_init()). So if it's being called twice, well, it shouldn't. I read your answer, and perhaps some Glade initialization routine is calling it redundantly. It would help to know what versions of Glade and GTK you're running.

As far as the other messages... GLib/GObject is an object system, with single-inheritance and RTTI (run-time type identification), implemented in C.

Those warning/critical pairs indicate that your some object pointers are failing an RTTI test pretty miserably. Such tests are common in GTK/GDK internals - things like, "I'm expecting this pointer to be a such-and-such, but I better make sure before I treat it that way." Each message pair you see indicates a pointer has been passed to such a routine, but what it points to is not only not the expected object type, it's not even pointing to anything the RTTI system recognizes, so the RTTI system is throwing up its hands.

The most likely culprits for such a pointer failing like that is:

  • It's a wild pointer that points to junk
  • It's stale - it used to point a legitimate object that has since been destructed
  • It points to a live object, but the object's contents have become corrupted so badly, the RTTI system can't figure out the object's type


Well, I'm still not sure what the warning means, but I figured out what was causing it:

I had a glade file with an AccelGroup in it. The AccelGroup was a property of the main Window and its MenuItems. I removed it from the Window. This is when the warning started. I fixed it by also deleting it from the glade file entirely (thus removing it from the menu items).

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜