View Single Post
electroaudio's Avatar
Posts: 381 | Thanked: 336 times | Joined on Jan 2011 @ Stockholm, Sweden
#1
I dont understand this error, but i dont understand C so well either...
When the code in pink is commented out, then the routine seem to work very well, but when the part in pink is part of the compilation, then the program will crash (sort of..) randomly with error sigsegv-11

Code:
GdkPixbuf *get_pixbuf_file (gchar *fullpath)
{   

    GdkPixbuf *pixbuf=NULL; 
	struct stat statbuf;
	int counter=0;
	char mychar;
	char xxx[50];
	char *mime_icon_name=NULL;
	gchar *mime_icon_file=NULL;
	gchar *test;
	gchar *file_open;
	GtkIconTheme *icon_theme;
	char *ext = strrchr(fullpath, '.');

	if (ext==NULL)
		...
	if (strstr(ext,".desktop") && strstr(".desktop",ext))
		...
	if (strstr(fullpath, "/folder.png") && (fast_mode==0))
		...
	mime_icon_name=NULL;
	if ((mime_icon_name=strrchr(fullpath, '.'))==0)
		..
             if ((statbuf.st_mode &S_IXUSR))
               ...


	memset (xxx,0,sizeof(xxx));
	  for ( counter = 0 ;  (counter<= (sizeof(xxx)-0)) && (mime_icon_name[counter]!=0) ; counter++ ){
		  mychar=mime_icon_name[counter];
		 xxx[counter]=(tolower(mychar));
		} 


	mime_icon_file=g_strconcat ("/home/user/.deskypplet/icons/",xxx+1,".png",NULL);

	if ((pixbuf=gdk_pixbuf_new_from_file_at_size(mime_icon_file,app->icon_x_size,app->icon_y_size,NULL))!=0)
		{
		 return pixbuf;
		}
	else
		{
		 pixbuf= gdk_pixbuf_new_from_file_at_size("/home/user/.deskypplet/icons/dummy.png",app->icon_x_size,app->icon_y_size,NULL);
		 return pixbuf;
		}		
}
Ps. I have deleted code that i dont believe has anything to do with it and replaced it with "..." to make it more readable
__________________
Deskypplet , a desktop for N900 *RIP*

Last edited by electroaudio; 2012-04-14 at 23:56.