[solved] Problems with crashes in C-Code
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) |
Re: Problems with crashes in C-Code
Maybe change
Code:
counter<=Code:
counter< |
Re: Problems with crashes in C-Code
xxx must be NULL terminated for the line after the pink code to not randomly crash. The pink code doesn't guarantee that. So, you might actually want to change:
Code:
counter<= (sizeof(xxx)-0Code:
counter< (sizeof(xxx)-1 |
Re: Problems with crashes in C-Code
Quote:
Unfourtunately that didnt help. But what about the definitions of the string? is it a guarantee that a declared pointer has any space to hold a string? Like the mime_icon_name , how can it have any allocated space to it to hold the 50 chars? |
Re: Problems with crashes in C-Code
Yes, exactly, define it the same as xxx. That should get you to point B. It's not very well written.
So, instead of: Code:
char *mime_icon_name=NULL;Code:
char mime_icon_name[50]; |
Re: Problems with crashes in C-Code
That feels much better, but now i get a lot of "incompatible types in assignment" errors from the compiler when the string is used instead.
Is it possible to rewrite the functions below to work again with this stringdefinition? Code:
mime_icon_name=NULL;Code:
.. && (mime_icon_name[counter]!=0) |
Re: Problems with crashes in C-Code
Sorry, it should be a pointer as it was.
It got its value from the parts that i had edited out. But after adding: Code:
if (mime_icon_name!=NULL){ ...}Now i only need to add a timer to prevent readdir() from getting stuck in /dev/ for example. :eek: |
Re: [solved] Problems with crashes in C-Code
That's what I figured.
|
| All times are GMT. The time now is 09:28. |
vBulletin® Version 3.8.8