On Mon, 09 Sep 2013, Rodolfo kix Garcia escribió:

> On Mon, 09 Sep 2013, Amadeusz Sławiński escribió:
> 
> > Hello,
> > 
> > I installed few dockapps and added them to dock, however when I edit
> > their wmaker settings (even when I don't change anything) and click
> > 'ok' it causes windowmaker to crash. For whatever reason it doesn't seem
> > to happen with normal applications.
> > 
> > I'm using freshly build wmaker from next branch. Only information
> > appearing on console is following line:
> > wmaker(MonitorLoop(monitor.c:132)): warning: Window Maker exited due to
> > a crash (signal 11) and will be restarted.
> > and then it restarts.
> > 
> > Amadeusz
> 
> Confirmed. I will check it now.
> 
> kix

Hi,

my patch c21c396fd381abb6cf23f0ad070a08a2c08a95be (wIconChangeImageFile returns 
rigth values) is wrong. The problem are these lines:

kix@osaka:~/src/wmaker/git/wmaker-crm/src$ grep wIconChangeImageFile *c | grep 
if
appicon.c:              if (wIconChangeImageFile(icon->icon, file) == False) {
dockedapp.c:            if (wIconChangeImageFile(panel->editedIcon->icon, text) 
== False) {
kix@osaka:~/src/wmaker/git/wmaker-crm/src$ 

The reason is because the function wIconChangeImageFile returns True when is 
OK, and False when it fails. When the filename field is empty, it returns False:

------- 8< ------
        /* If no new image, don't do nothing */
        if (!file)
                return False;
------- 8< ------

But the "if" blocks do this:

if (wIconChangeImageFile(panel->editedIcon->icon, text) == False) {

so, the returned value is used on this way:

if (False == False) { <-- Then, is true.

We should change these lines:

kix@osaka:~/src/wmaker/git/wmaker-crm/src$ grep wIconChangeImageFile *c | grep 
if
appicon.c:              if (wIconChangeImageFile(icon->icon, file) == False) {
dockedapp.c:            if (wIconChangeImageFile(panel->editedIcon->icon, text) 
== False) {
kix@osaka:~/src/wmaker/git/wmaker-crm/src$

to

kix@osaka:~/src/wmaker/git/wmaker-crm/src$ grep wIconChangeImageFile *c | grep 
if
appicon.c:              if (wIconChangeImageFile(icon->icon, file)) {
dockedapp.c:            if (wIconChangeImageFile(panel->editedIcon->icon, 
text)) {
kix@osaka:~/src/wmaker/git/wmaker-crm/src$

I tested it here, editing the icon, and is ok.

Sorry for this issue, patch is attached.

Thanks Amadeusz for your report.
kix.
>From f129c7f2d7e85aa97a1f6870bc5366cf36207c2f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?"Rodolfo=20Garc=C3=ADa=20Pe=C3=B1as=20(kix)"?= <[email protected]>
Date: Mon, 9 Sep 2013 01:08:13 +0200
Subject: [PATCH] Bug with wIconChangeImageFile return value usage

The patch c21c396fd381abb6cf23f0ad070a08a2c08a95be (wIconChangeImageFile returns rigth values) is wrong. The problem are these lines:

kix@osaka:~/src/wmaker/git/wmaker-crm/src$ grep wIconChangeImageFile *c | grep if
appicon.c:              if (wIconChangeImageFile(icon->icon, file) == False) {
dockedapp.c:            if (wIconChangeImageFile(panel->editedIcon->icon, text) == False) {
kix@osaka:~/src/wmaker/git/wmaker-crm/src$

The reason is because the function wIconChangeImageFile returns True when is OK, and False when it fails. When the filename field is empty, it returns False:

------- 8< ------
        /* If no new image, don't do nothing */
        if (!file)
                return False;
------- 8< ------

But the "if" blocks do this:

if (wIconChangeImageFile(panel->editedIcon->icon, text) == False) {

so, the returned value is used on this way:

if (False == False) { <-- Then, is true.

This patch changes these lines:

kix@osaka:~/src/wmaker/git/wmaker-crm/src$ grep wIconChangeImageFile *c | grep if
appicon.c:              if (wIconChangeImageFile(icon->icon, file) == False) {
dockedapp.c:            if (wIconChangeImageFile(panel->editedIcon->icon, text) == False) {
kix@osaka:~/src/wmaker/git/wmaker-crm/src$

to

kix@osaka:~/src/wmaker/git/wmaker-crm/src$ grep wIconChangeImageFile *c | grep if
appicon.c:              if (wIconChangeImageFile(icon->icon, file)) {
dockedapp.c:            if (wIconChangeImageFile(panel->editedIcon->icon, text)) {
kix@osaka:~/src/wmaker/git/wmaker-crm/src$
---
 src/appicon.c   |    2 +-
 src/dockedapp.c |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/appicon.c b/src/appicon.c
index 397bed1..b7b1a0b 100644
--- a/src/appicon.c
+++ b/src/appicon.c
@@ -541,7 +541,7 @@ static void setIconCallback(WMenu *menu, WMenuEntry *entry)
 			wfree(file);
 			file = NULL;
 		}
-		if (wIconChangeImageFile(icon->icon, file) == False) {
+		if (wIconChangeImageFile(icon->icon, file)) {
 			wMessageDialog(scr, _("Error"),
 				       _("Could not open specified icon file"), _("OK"), NULL, NULL);
 		} else {
diff --git a/src/dockedapp.c b/src/dockedapp.c
index 6aee864..78d9fc2 100644
--- a/src/dockedapp.c
+++ b/src/dockedapp.c
@@ -161,7 +161,7 @@ static void panelBtnCallback(WMWidget * self, void *data)
 			text = NULL;
 		}
 
-		if (wIconChangeImageFile(panel->editedIcon->icon, text) == False) {
+		if (wIconChangeImageFile(panel->editedIcon->icon, text)) {
 			char *buf;
 			int len = strlen(text) + 64;
 
-- 
1.7.10.4

Reply via email to