Re: How many times can I call gtk_label_set_markup()?



On Fri, Apr 08, 2011 at 01:17:52AM -0700, Igor Korot wrote:
> I need to change the markup text in the label conditionally in the loop.
> However, I'm getting this on the second call of gtk_label_set_markup():
> 
> (mini2440gtk:19672): GLib-GObject-WARNING **: invalid cast from
> `(null)' to `GObject'
> 
> (mini2440gtk:19672): GLib-GObject-CRITICAL **: g_object_freeze_notify:
> assertion `G_IS_OBJECT (object)' failed
> 
> (mini2440gtk:19672): GLib-GObject-WARNING **: invalid cast from
> `(null)' to `GObject'
> 
> (mini2440gtk:19672): GLib-GObject-CRITICAL **: g_object_notify:
> assertion `G_IS_OBJECT (object)' failed
> 
> (mini2440gtk:19672): GLib-GObject-WARNING **: invalid cast from
> `(null)' to `GtkWidget'
> 
> (mini2440gtk:19672): Gtk-CRITICAL **: gtk_widget_queue_resize:
> assertion `GTK_IS_WIDGET (widget)' failed
> 
> (mini2440gtk:19672): GLib-GObject-WARNING **: invalid cast from
> `(null)' to `GObject'
> 
> (mini2440gtk:19672): GLib-GObject-CRITICAL **: g_object_thaw_notify:
> assertion `G_IS_OBJECT (object)' failed
> 
> I checked and the window and the text are both not NULL.
> 
> Is it possible to do it this way? Or I just need to dereference something?

gtk_label_set_markup() can be called an arbitrary number of times.
You do not need to *dereference* anything.  You may need to reference
the label – if it's been removed from the container it was in.

Otherwise the only conclusion that can be made from this is that you
code is buggy.

Run it with G_DEBUG=fatal-warnings to obtain a stack trace at the first
warning and see what exactly gets the NULL pointer instead of an object.

Yeti



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]