>From 80a6bcd1eb4daf434adc5b55032d4297d9aff915 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?"Rodolfo=20Garc=C3=ADa=20Pe=C3=B1as=20(kix)"?= <[email protected]>
Date: Thu, 15 Nov 2012 00:53:03 +0100
Subject: [PATCH 3/6] wIconUpdate wwin checks
The variable wwin is only used in one block of the if, so should be moved
inside this block. OTOH, is better check if the variabl exists before
assign it. The code now is more stable and avoid crashes.
---
src/icon.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/src/icon.c b/src/icon.c
index ddcf167..de766ad 100644
--- a/src/icon.c
+++ b/src/icon.c
@@ -601,11 +601,14 @@ static void unset_icon_image(WIcon *icon)
void wIconUpdate(WIcon *icon, RImage *image)
{
- WWindow *wwin = icon->owner;
+ WWindow *wwin = NULL;
if (image) {
icon->file_image = image;
} else {
+ if (icon && icon->owner)
+ wwin = icon->owner;
+
if (wwin && WFLAGP(wwin, always_user_icon)) {
/* Forced use user_icon */
get_rimage_icon_from_user_icon(icon);
--
1.7.10.4
>From 80a6bcd1eb4daf434adc5b55032d4297d9aff915 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?"Rodolfo=20Garc=C3=ADa=20Pe=C3=B1as=20(kix)"?= <[email protected]>
Date: Thu, 15 Nov 2012 00:53:03 +0100
Subject: [PATCH 3/6] wIconUpdate wwin checks
The variable wwin is only used in one block of the if, so should be moved
inside this block. OTOH, is better check if the variabl exists before
assign it. The code now is more stable and avoid crashes.
---
src/icon.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/src/icon.c b/src/icon.c
index ddcf167..de766ad 100644
--- a/src/icon.c
+++ b/src/icon.c
@@ -601,11 +601,14 @@ static void unset_icon_image(WIcon *icon)
void wIconUpdate(WIcon *icon, RImage *image)
{
- WWindow *wwin = icon->owner;
+ WWindow *wwin = NULL;
if (image) {
icon->file_image = image;
} else {
+ if (icon && icon->owner)
+ wwin = icon->owner;
+
if (wwin && WFLAGP(wwin, always_user_icon)) {
/* Forced use user_icon */
get_rimage_icon_from_user_icon(icon);
--
1.7.10.4