(same as in Kix's BTS)
From d807ca2a7562dfd2656bcf840d4438bfe15d4800 Mon Sep 17 00:00:00 2001
From: Christophe CURIS <[email protected]>
Date: Tue, 9 Oct 2012 00:20:44 +0200
Subject: [PATCH] [Bug #0000001] 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.
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.
---
 src/icon.c |    5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/icon.c b/src/icon.c
index e950a7d..0370d71 100644
--- a/src/icon.c
+++ b/src/icon.c
@@ -369,11 +369,12 @@ Bool wIconChangeImageFile(WIcon * icon, char *file)
 	char *path;
 	int error = 0;
 
-	if (icon->file_image)
+	if (icon->file_image) {
 		RReleaseImage(icon->file_image);
+		icon->file_image = NULL;
+	}
 
 	if (!file) {
-		icon->file_image = NULL;
 		wIconUpdate(icon);
 		return True;
 	}
-- 
1.7.10.4

Reply via email to