GTK+ Forums

Discussion forum for GTK+ and Programming. Ask questions, troubleshoot problems, view and post example code, or express your opinions.
It is currently Tue Sep 30, 2014 5:53 pm

All times are UTC




Post new topic Reply to topic  [ 5 posts ] 
Author Message
 Post subject: GDK region assertion
PostPosted: Mon Sep 17, 2012 9:42 am 
Offline

Joined: Mon Sep 17, 2012 9:36 am
Posts: 3
Hi, I have a piece of code, which is sets up the label of a button multiple times very quickly in a loop. However in multiple runs, I am coming across an assertion which I am unable to figure out why?

I think there is something in gtk_label_set_markup() which I am missing.The assertion is:
Quote:
Gdk:ERROR:/build/buildd/gtk+2.0-2.24.6/gdk/gdkregion-generic.c:1110:miUnionNonO: assertion failed: (y1 < y2)

And the core dump says:
Quote:
(gdb) bt
#0 0x0045a416 in __kernel_vsyscall ()
#1 0x009e5c8f in __GI_raise (sig=6)
at ../nptl/sysdeps/unix/sysv/linux/raise.c:64
#2 0x009e92b5 in __GI_abort () at abort.c:92
#3 0x00bdc6ce in g_assertion_message ()
from /lib/i386-linux-gnu/libglib-2.0.so.0
#4 0x00bdcccf in g_assertion_message_expr ()
from /lib/i386-linux-gnu/libglib-2.0.so.0
#5 0x00381310 in ?? () from /usr/lib/i386-linux-gnu/libgdk-x11-2.0.so.0
#6 0x00382392 in ?? () from /usr/lib/i386-linux-gnu/libgdk-x11-2.0.so.0
#7 0x00382d24 in gdk_region_union ()
from /usr/lib/i386-linux-gnu/libgdk-x11-2.0.so.0
#8 0x0038cddb in ?? () from /usr/lib/i386-linux-gnu/libgdk-x11-2.0.so.0
#9 0x006cde27 in ?? () from /usr/lib/i386-linux-gnu/libgtk-x11-2.0.so.0
#10 0x006d4026 in ?? () from /usr/lib/i386-linux-gnu/libgtk-x11-2.0.so.0
#11 0x006d40b3 in gtk_widget_queue_resize ()
from /usr/lib/i386-linux-gnu/libgtk-x11-2.0.so.0
#12 0x00582fe2 in ?? () from /usr/lib/i386-linux-gnu/libgtk-x11-2.0.so.0
#13 0x00584658 in gtk_label_set_markup ()
from /usr/lib/i386-linux-gnu/libgtk-x11-2.0.so.0
#14 0x080850ea in set_button_label_text (text=0xb763751c "LT100223", rubno=6)


Top
 Profile  
 
 Post subject: Re: GDK region assertion
PostPosted: Tue Sep 18, 2012 8:38 am 
Offline

Joined: Mon Sep 17, 2012 9:36 am
Posts: 3
Code:
void set_text(gchar * text,  GtkWidget* widg)
{
        gchar bLRustr[256];
        g_strlcpy(bLRustr, "<span font_desc='", sizeof bLRustr);
        g_strlcat(bLRustr, tu->u_button_number_font, sizeof bLRustr);
        g_strlcat(bLRustr, "'><b>", sizeof bLRustr);
        g_strlcat(bLRustr, text, sizeof bLRustr);
        g_strlcat(bLRustr, "</b></span>", sizeof bLRustr);
        // set the Top Label on the Button
        gtk_label_set_markup(GTK_LABEL(widg),bLRustr);
}


Basically there are several functions like the one written above. During load testing, when I am setting the text of a label many times in a loop, the software crashes with an assertion,
Quote:
Gdk:ERROR:/build/buildd/gtk+2.0-2.24.6/gdk/gdkregion-generic.c:1110:miUnionNonO: assertion failed: (y1 < y2)


Top
 Profile  
 
 Post subject: Re: GDK region assertion
PostPosted: Wed Sep 19, 2012 7:57 am 
Offline
Never Seen the Sunlight

Joined: Mon Apr 28, 2008 5:52 am
Posts: 750
Location: UK
Hi,

It is a bit hard to tell what has really happened with such a short section of code and not knowing what the inputs are. My only thoughts are

- You may be providing invalid input causing bad mark-up.
- You could be overflowing the buffer again causing bad mark-up. Note you have space only for another 222 characters of data.

To avoid the second case I would use something like the example below. This still does not guard against invalid mark-up.
Note you will need to include the header file <glib/gprintf.h>.

Code:
void set_text(gchar * text,  GtkWidget* widg)
{
        gchar *bLRustr;

        bLRustr = g_strdup_printf("<span font_desc='%s'><b>%s</b></span>",
            tu->u_button_number_font, text);

        // set the Top Label on the Button
        gtk_label_set_markup(GTK_LABEL(widg), bLRustr);

        g_free(bLRustr);
}

_________________
E.


Top
 Profile  
 
 Post subject: Re: GDK region assertion
PostPosted: Thu Sep 20, 2012 9:56 am 
Offline

Joined: Mon Sep 17, 2012 9:36 am
Posts: 3
I do understand your point, and that was my first thought as well,
however in the stack trace, if you notice the text I am passing is

Quote:
LT100223


Code:
#13 0x00584658 in gtk_label_set_markup ()
from /usr/lib/i386-linux-gnu/libgtk-x11-2.0.so.0
#14 0x080850ea in set_button_label_text (text=0xb763751c "LT100223", rubno=6)


I dont see a reason why it should get corrupted with a string of length 8.
Having said that, your idea is noble, and I shall try and load test with that.


Top
 Profile  
 
 Post subject: Re: GDK region assertion
PostPosted: Thu Sep 20, 2012 5:42 pm 
Offline
Never Seen the Sunlight

Joined: Mon Apr 28, 2008 5:52 am
Posts: 750
Location: UK
I ignored your stack trace as it did not seam to correspond to your sample code.

_________________
E.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 5 posts ] 

All times are UTC


Who is online

Users browsing this forum: Google Adsense [Bot] and 4 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group