1
0
mirror of https://github.com/gryf/wmaker.git synced 2025-12-23 14:42:29 +01:00

Fixed crash when changing icon to non-existent file

As found by Rodolfo, a crash could happen when changing an icon to
a non-existent file. From his report:

Steps To Reproduce
1. Open the Settings box, for example for WMDock. (Right click on WMDock, Settings).
2. In the "Icon Image" field, write some characters. For example "asdfasdfasd".
3. Click in "OK". You get "Could not open specified icon file: GNUstep.tiffasdfasdfasd"
4. Hit in "OK"
5. Repeat 2,3,4 some times (sometimes 1, sometimes 2, sometimes 10).

The problem came from freeing the previous icon but not updating
the pointer, so if the new file did not exist it ended up with a
fake-looking icon being used, hence possible crash.

BTS: http://www.kix.es/mantis/view.php?id=1
This commit is contained in:
Christophe CURIS
2012-10-09 00:20:44 +02:00
committed by Carlos R. Mafra
parent e357e94896
commit baecab089c

View File

@@ -369,11 +369,12 @@ Bool wIconChangeImageFile(WIcon * icon, char *file)
char *path; char *path;
int error = 0; int error = 0;
if (icon->file_image) if (icon->file_image) {
RReleaseImage(icon->file_image); RReleaseImage(icon->file_image);
icon->file_image = NULL;
}
if (!file) { if (!file) {
icon->file_image = NULL;
wIconUpdate(icon); wIconUpdate(icon);
return True; return True;
} }