LinuxQuestions.org
Did you know LQ has a Linux Hardware Compatibility List?
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices

Reply
 
Search this Thread
Old 05-07-2009, 08:26 AM   #1
benni1
LQ Newbie
 
Registered: Apr 2009
Posts: 10

Rep: Reputation: 0
_int_free() call crashes in gtk/pango lib (segmentation fault), what is the reason


hi,
i used gdb for my core file with this result (backtrace):


#0 0xb79c38d2 in _int_free () from /lib/tls/libc.so.6
#1 0xb79c40ea in free () from /lib/tls/libc.so.6
#2 0xb7ad2d61 in g_free () from /usr/lib/libglib-2.0.so.0
#3 0xb7bc58a5 in pango_glyph_string_free () from /usr/lib/libpango-1.0.so.0
#4 0xb7bcf2dc in pango_layout_line_index_to_x () from /usr/lib/libpango-1.0.so.0
#5 0xb7ae25af in g_slist_foreach () from /usr/lib/libglib-2.0.so.0
#6 0xb7bd004e in pango_layout_line_unref () from /usr/lib/libpango-1.0.so.0
#7 0xb7bd0153 in pango_layout_iter_free () from /usr/lib/libpango-1.0.so.0
#8 0xb7bd0a7d in pango_layout_set_width () from /usr/lib/libpango-1.0.so.0
#9 0xb7b42351 in g_object_unref () from /usr/lib/libgobject-2.0.so.0
#10 0xb7de44e8 in gtk_label_get () from /usr/lib/libgtk-x11-2.0.so.0
#11 0xb7de6ac9 in gtk_label_set_attributes () from /usr/lib/libgtk-x11-2.0.so.0
#12 0xb7de71f1 in gtk_label_set_markup () from /usr/lib/libgtk-x11-2.0.so.0
#13 0x080529d7 in Init_Text () at gtk_gui.c:1922

#14 0x08054d6c in navigate_menus () at gtk_gui.c:3012
#15 0x08056212 in gui_loop () at gtk_gui.c:3382
#16 0x0804b419 in main (argc=1, argv=0xbfee1f64) at main.c:284

#13 is my last own function call. as this problem only occurs from time to time its very hard for me to find the problem, hope someone can give me a hint. init_text() is called in a loop but as i know shouldn't the problem that i free something twice. maybe it is a bug in the pango lib? here is the function Init_Text():
First the important code where i think is the prob:

Init_Text(){
if...{}
else{
gtk_label_set_markup(GTK_LABEL(Artikel_label[i-
index_artikel]),text[i-index_artikel]);


gtk_label_set_markup(GTK_LABEL(Artikel_label_select_1[i-
index_artikel]),text_undertext[i-
index_artikel]);

gtk_label_set_markup(GTK_LABEL(Artikel_label_select_2[i-
index_artikel]),text_price[i-index_artikel]);


sprintf(text[i-index_artikel]," ");
sprintf(text_undertext[i-index_artikel]," ");
sprintf(text_price[i-index_artikel]," ");

free(text[i-index_artikel]);
free(text_undertext[i-index_artikel]);
free(text_price[i-index_artikel]);
}
seite=(index_artikel/10)+1;
von_seiten=(count_selected/10)+1;
snprintf(label_text,sizeof(label_text),"<span font_desc=\"sans 12\">Seite %d von %d </span>",seite,von_seiten);

gtk_label_set_markup(GTK_LABEL(label_seite), label_text);

gtk_widget_show(label_seite);
}
***
the prob is as it seems to me the set_markup_functions or one of them.
i dont know why because this works out 9 of 10 times.
hope u can help me.
and here is the whole function:
***

void Init_Text()
{
int i=0,seite=1,von_seiten=1;

char bild_file[80];
if(index_artikel>count_selected)index_artikel=0;
for(i=index_artikel;i<index_artikel+10;i++)
{
text[i-index_artikel]=(char*)malloc(350*sizeof(char));
text_undertext[i-index_artikel]=char*)malloc(350*sizeof(char));
text_price[i-index_artikel]=(char*)malloc(350*sizeof(char));
if(i<count_selected)
{
komma_format(SelectedGroup[i].Preis, temp);
text[i-index_artikel]=strcpy(text[i-index_artikel],"<span font_desc=\"sans 12\"><b> " );
text[i-index_artikel]=strcat(text[i-index_artikel], SelectedGroup[i].Name);
text[i-index_artikel]=strcat(text[i-index_artikel], " ");

text[i-index_artikel]=strcat(text[i-index_artikel],"</b></span>");
text_price[i-index_artikel]=strcpy(text_price[i-index_artikel],"<span font_desc=\"sans 12\"><b> " );
text_price[i-index_artikel]=strcat(text_price[i-index_artikel], temp);
text_price[i-index_artikel]=strcat(text_price[i-index_artikel]," EUR</b></span>");

if(strlen(SelectedGroup[i].Path_Pic)==0)sprintf(SelectedGroup[i].Path_Pic,"keinbild.");
snprintf(bild_file,sizeof(bild_file), "/mnt/usb/bilder/%s",SelectedGroup[i].Path_Pic);

gtk_image_set_from_file (Image[i-index_artikel],bild_file);


gtk_widget_show (Image[i-index_artikel]);
text_undertext[i-index_artikel]=strcpy(text_undertext[i-index_artikel],"<span font_desc=\"sans 11\"><i> " );
snprintf(temp,sizeof(temp),"%d",SelectedGroup[i].AnzahlFlaschen);
text_undertext[i-index_artikel]=strcat(text_undertext[i-index_artikel], temp);
text_undertext[i-index_artikel]=strcat(text_undertext[i-index_artikel], SelectedGroup[i].Text);
text_undertext[i-index_artikel]=strcat(text_undertext[i-index_artikel], " Pfand ");
komma_format(SelectedGroup[i].PfKisten, temp);
text_undertext[i-index_artikel]=strcat(text_undertext[i-index_artikel], temp);
text_undertext[i-index_artikel]=strcat(text_undertext[i-index_artikel]," EUR</i></span>");

color.red=0xffff;
color.green=0xffff;
color.blue=0xffff;
gtk_widget_modify_bg (Artikel_button[i-index_artikel], GTK_STATE_NORMAL, &color);
color.red=0xffff;
color.green=0xffff;
color.blue=0xffff;
gtk_widget_modify_bg (Artikel_button[i-index_artikel], GTK_STATE_PRELIGHT, &color);
color.red=0xffff;
color.green=0x9999;
color.blue=0x0000;
gtk_widget_modify_bg (Artikel_button[i-index_artikel], GTK_STATE_ACTIVE, &color);

gtk_button_set_image((GtkButton*)Artikel_button[i-index_artikel],(GtkWidget*)Image[i-index_artikel]);
gtk_widget_show (Artikel_button[i-index_artikel]);
AllowToPress[i-index_artikel]=1;
}
else
{
sprintf(text[i-index_artikel]," ");
sprintf(text_undertext[i-index_artikel]," ");
sprintf(text_price[i-index_artikel]," ");
gtk_widget_hide (Artikel_button[i-index_artikel]);
gtk_widget_hide (Arrows[i-index_artikel]);
gtk_widget_hide (Image[i-index_artikel]);
AllowToPress[i-index_artikel]=0;
}
gtk_label_set_markup(GTK_LABEL(Artikel_label[i-index_artikel]),text[i-index_artikel]);
gtk_label_set_markup(GTK_LABEL(Artikel_label_select_1[i-index_artikel]),text_undertext[i-index_artikel]);
gtk_label_set_markup(GTK_LABEL(Artikel_label_select_2[i-index_artikel]),text_price[i-index_artikel]);

sprintf(text[i-index_artikel]," ");
sprintf(text_undertext[i-index_artikel]," ");
sprintf(text_price[i-index_artikel]," ");

free(text[i-index_artikel]);
free(text_undertext[i-index_artikel]);
free(text_price[i-index_artikel]);
}
seite=(index_artikel/10)+1;
von_seiten=(count_selected/10)+1;
snprintf(label_text,sizeof(label_text),"<span font_desc=\"sans 12\">Seite %d von %d </span>",seite,von_seiten);
gtk_label_set_markup(GTK_LABEL(label_seite), label_text);
gtk_widget_show(label_seite);
}
 
Old 05-08-2009, 02:46 AM   #2
Peter_APIIT
Member
 
Registered: Dec 2006
Posts: 551

Rep: Reputation: 30
Crash often caused by memory access violation.
 
Old 05-08-2009, 08:36 AM   #3
benni1
LQ Newbie
 
Registered: Apr 2009
Posts: 10

Original Poster
Rep: Reputation: 0
which means?
Is the fault in my programm or in the library?

Please give me a hint
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
gtk+-2.0.8 not finding pango for some reason. prismra Linux - Software 3 08-20-2005 04:00 PM
GPDF/XPDF Crashes/Segmentation fault Tarrin Linux - Software 4 03-16-2005 04:10 PM
evolution 1.4 crashes upon options menu (segmentation fault) rob1477 Linux - Newbie 3 09-18-2004 03:19 AM
segmentation fault with my Gtk Application jaganmolleti Programming 1 03-18-2003 11:05 AM
segmentation fault w/ c++ function call wsimmons Programming 3 10-16-2001 02:06 AM


All times are GMT -5. The time now is 06:06 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration