On 2012-10-24 15:09, Carlos R. Mafra wrote:
On Wed, 24 Oct 2012 at  8:45:47 +0200, Rodolfo García Peñas wrote:

And, wmaker crash. Why? because IMO the code used to remove items
from the HastTables (domain database) is wrong. It removes the
item, but don't "removes the hole", then the next search in the
hashtable, returns the item in the "hole", a memory "no-item" (trash, the " f"). The code is at WINGs/hashtable.c, functions WMHashRemove()
and deleteFromList(). Help is very appreciated. Probably you can
reproduce the problem renaming the defaultAppIcon.tiff image after
wmaker is up and launching a application without icon (declare a non
exist file in WMState file).

Does the crash happen without your patches too?

Yes.

I was working some months ago in this part, join the functions with RLoadImage in only one. The code of RImage *get_default_icon_rimage(WScreen *scr, char *file_name, int max_size) is used exactly in other functions at icon.c. When I tried to replace the dup code, I got the error. I left the analisys and I continued with other parts of the icon code, but now is time to solve it. These are the functions with dup code in the source:

For example:

Original function at wdefaults.c :
422 /* This function returns the image picture for the file_name file */ 423 RImage *get_default_icon_rimage(WScreen *scr, char *file_name, int max_size)
424 {
425 RImage *image = NULL;
426
427 if (!file_name)
428 return NULL;
429
430 image = RLoadImage(scr->rcontext, file_name, 0);
431 if (!image)
432 wwarning(_("error loading image file \"%s\": %s"), file_name,
433 RMessageForError(RErrorCode));
434
435 image = wIconValidateIconSize(image, max_size);
436
437 return image;
438 }

At icon.c

613 void get_pixmap_icon_from_user_icon(WScreen *scr, WIcon * icon)
...
626 file = wDefaultGetIconFile(NULL, NULL, True);
627 if (file) {
628 path = FindImage(wPreferences.icon_path, file);
629 if (path) {
630 image = RLoadImage(scr->rcontext, path, 0);
631 if (!image)
632 wwarning(_("could not load default icon \"%s\":%s"),
633 file, RMessageForError(RErrorCode));
634 wfree(path);
635 } else {
636 wwarning(_("could not find default icon \"%s\""), file);
637 }
638 }
639
640 image = wIconValidateIconSize(image, wPreferences.icon_size);

and

365 Bool wIconChangeImageFile(WIcon * icon, char *file)
...
382 path = FindImage(wPreferences.icon_path, file);
383
384 if (path && (image = RLoadImage(scr->rcontext, path, 0))) {
385 icon->file_image = wIconValidateIconSize(image, wPreferences.icon_size);

About the hashtable, I think we need a "rebuildTable(table)" call at the end of WMHashRemove function, to re-create the hash table. I found it in my notes I wrote the first time I tried to remove the dup code. We need to check it.

The problem with full path, I didn't found info in my notes, so... I need more time... or more help.

Cheers,
kix
--
||// //\\// Rodolfo "kix" Garcia
||\\// //\\ http://www.kix.es/


--
To unsubscribe, send mail to [email protected].

Reply via email to