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



And the first time I am using this function is in this code:

data1 = gtk_label_new( NULL );
gtk_label_set_markup( GTK_LABEL( data1 ), m_data1->str );
g_free( m_data1->str );
gtk_table_attach( GTK_TABLE( table ), data1, 0, 1, 1, 2, GTK_EXPAND,
GTK_EXPAND, 0, 0 );
gtk_widget_show( data1 );

Thank you.

On Fri, Apr 8, 2011 at 11:00 AM, Igor Korot <ikorot01 gmail com> wrote:
> Hi, David,
>
> 2011/4/8 David Nečas <yeti physics muni cz>:
>> On Fri, Apr 08, 2011 at 10:30:32AM -0700, Igor Korot wrote:
>>> $ ./<program_name> G_DEBUG=fatal-warnings
>>>
>>> Right?
>>
>> No,
>>
>>    G_DEBUG=fatal-warnings ./program
>>
>> It's an environment variable:
>>
>>    http://developer.gnome.org/glib/stable/glib-running.html
>
> I just tried to run it. Here are the results:
>
> IgorsGentooOnNetwork src # G_DEBUG=fatal-warnings gdb mini2440gtk
> GNU gdb 6.8
> Copyright (C) 2008 Free Software Foundation, Inc.
> License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
> This is free software: you are free to change and redistribute it.
> There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
> and "show warranty" for details.
> This GDB was configured as "i686-pc-linux-gnu"...
> (gdb) break main_window.cc:282
> Breakpoint 1 at 0x80496d4: file
> /home/igor/mini2440gtk/mini2440gtk/src/main_window.cc, line 282.
> (gdb) run
> Starting program: /home/igor/mini2440gtk/mini2440gtk/debug/src/mini2440gtk
> [Thread debugging using libthread_db enabled]
> [New Thread 0xb7106b40 (LWP 22539)]
> Header is: 0 0
> Header is: 27 91
>
> GLib-GObject-WARNING **: invalid cast from `(null)' to `GObject'
> aborting...
>
> Program received signal SIGABRT, Aborted.
> [Switching to Thread 0xb7106b40 (LWP 22539)]
> 0xb805c424 in __kernel_vsyscall ()
> (gdb) bt
> #0  0xb805c424 in __kernel_vsyscall ()
> #1  0xb7169660 in raise () from /lib/libc.so.6
> #2  0xb716ae98 in abort () from /lib/libc.so.6
> #3  0xb73d4a31 in g_logv () from /usr/lib/libglib-2.0.so.0
> #4  0xb73d4ace in g_log () from /usr/lib/libglib-2.0.so.0
> #5  0xb7477896 in g_type_check_instance_cast () from
> /usr/lib/libgobject-2.0.so.0
> #6  0xb7a14e9c in gtk_label_set_markup () from /usr/lib/libgtk-x11-2.0.so.0
> #7  0x080496d4 in CFrame::UpdateData (this=0x8f48450) at
> /home/igor/mini2440gtk/mini2440gtk/src/main_window.cc:281
> #8  0x08049813 in CFrame::ReadData (me=0x8f48450) at
> /home/igor/mini2440gtk/mini2440gtk/src/main_window.cc:256
> #9  0xb73cdad2 in ?? () from /usr/lib/libglib-2.0.so.0
> #10 0x08f48450 in ?? ()
> #11 0xb7452534 in ?? () from /usr/lib/libglib-2.0.so.0
> #12 0xbfde3dd8 in ?? ()
> #13 0xb73cda9f in ?? () from /usr/lib/libglib-2.0.so.0
> #14 0xb7856f00 in ?? () from /usr/lib/libgdk-x11-2.0.so.0
> #15 0x08f1b008 in ?? ()
> #16 0xbfde3e08 in ?? ()
> #17 0xb73ccb5c in ?? () from /usr/lib/libglib-2.0.so.0
> #18 0xb7452534 in ?? () from /usr/lib/libglib-2.0.so.0
> #19 0x08f22098 in ?? ()
> #20 0xbfde3df8 in ?? ()
> #21 0xb7451ff4 in ?? () from /usr/lib/libglib-2.0.so.0
> #22 0xbfde3e3c in ?? ()
> #23 0x08f4fc00 in ?? ()
> #24 0xbfde3e58 in ?? ()
> #25 0xb73cd1b9 in g_main_context_dispatch () from /usr/lib/libglib-2.0.so.0
> Backtrace stopped: previous frame inner to this frame (corrupt stack?)
>
> Running the program without G_DEBUG gives:
>
> IgorsGentooOnNetwork src # gdb mini2440gtk
> GNU gdb 6.8
> Copyright (C) 2008 Free Software Foundation, Inc.
> License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
> This is free software: you are free to change and redistribute it.
> There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
> and "show warranty" for details.
> This GDB was configured as "i686-pc-linux-gnu"...
> (gdb) break main_window.cc:282
> Breakpoint 1 at 0x80496d4: file
> /home/igor/mini2440gtk/mini2440gtk/src/main_window.cc, line 282.
> (gdb) run
> Starting program: /home/igor/mini2440gtk/mini2440gtk/debug/src/mini2440gtk
> [Thread debugging using libthread_db enabled]
> [New Thread 0xb70d6b40 (LWP 22570)]
> Header is: 0 0
> Header is: 27 91
>
> (mini2440gtk:22570): GLib-GObject-WARNING **: invalid cast from
> `(null)' to `GObject'
>
> (mini2440gtk:22570): GLib-GObject-CRITICAL **: g_object_freeze_notify:
> assertion `G_IS_OBJECT (object)' failed
>
> (mini2440gtk:22570): GLib-GObject-WARNING **: invalid cast from
> `(null)' to `GObject'
>
> (mini2440gtk:22570): GLib-GObject-CRITICAL **: g_object_notify:
> assertion `G_IS_OBJECT (object)' failed
>
> (mini2440gtk:22570): GLib-GObject-WARNING **: invalid cast from
> `(null)' to `GtkWidget'
>
> (mini2440gtk:22570): Gtk-CRITICAL **: gtk_widget_queue_resize:
> assertion `GTK_IS_WIDGET (widget)' failed
>
> (mini2440gtk:22570): GLib-GObject-WARNING **: invalid cast from
> `(null)' to `GObject'
>
> (mini2440gtk:22570): GLib-GObject-CRITICAL **: g_object_thaw_notify:
> assertion `G_IS_OBJECT (object)' failed
> [Switching to Thread 0xb70d6b40 (LWP 22570)]
>
> Breakpoint 1, CFrame::UpdateData (this=0x94e1450) at
> /home/igor/mini2440gtk/mini2440gtk/src/main_window.cc:282
> 282             gtk_label_set_markup( GTK_LABEL( data2 ), m_data2->str );
> (gdb) print data1
> $1 = (GtkWidget *) 0x94e80b0
> (gdb) print m_data1->str
> $2 = (gchar *) 0x94dfee0 "<b><span foreground=\"black\"><span
> font=\"Sans Serif\"><span font='48'>14.00</span></span>V</span></b>"
>
> And here is the code for offending function:
>
> void CFrame::UpdateData()
> {
>        ConvertTotalPack();
>        ConvertMinimalVoltage();
>        ConvertMaximumVoltage();
>        SetColoring();
>        gtk_label_set_markup( GTK_LABEL( data1 ), m_data1->str );
>        gtk_label_set_markup( GTK_LABEL( data2 ), m_data2->str );
>        gtk_label_set_markup( GTK_LABEL( data3 ), m_data3->str );
>        gtk_label_set_markup( GTK_LABEL( data4 ), m_data4->str );
> }
>
> Do you see anything wrong with it?
>
> Thank you.
>
>>
>> Yeti
>>
>>
>


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