! Please note that this is a snapshot of our old Bugzilla server, which is read only since May 29, 2020. Please go to gitlab.xfce.org for our new server !
xfce-desktop.c:1198:13: warning: this ‘if’ clause does not guard... [-Wmislea...
Status:
RESOLVED: FIXED
Product:
Xfdesktop
Component:
General

Comments

Description David Binderman 2019-06-05 09:20:04 CEST
Source code is

            /* no icons on the desktop, grab the focus and pop up the menu */
            if(!gtk_widget_has_grab(w))
                gtk_grab_add(w);

                xfce_desktop_popup_root_menu(desktop, button, evt->time);
                return TRUE;

maybe better code

            /* no icons on the desktop, grab the focus and pop up the menu */
            if(!gtk_widget_has_grab(w)) {
                gtk_grab_add(w);

                xfce_desktop_popup_root_menu(desktop, button, evt->time);
                return TRUE;
            }
Comment 1 Theo Linkspfeifer editbugs 2019-06-05 10:56:14 CEST
Thanks for the report. Which xfdesktop version is that?

https://git.xfce.org/xfce/xfdesktop/commit/?id=b94027ad3c0e74cebdd28c586d0d361a7d8ecb97
Comment 2 David Binderman 2019-06-05 14:37:20 CEST
Latest released version, aka 4.12.5.

Should the comment just above be updated to more accurately document
what the code is doing ?
Comment 3 Theo Linkspfeifer editbugs 2019-06-07 20:00:07 CEST
How would you change the comment? This is 4.13 (git master):

https://git.xfce.org/xfce/xfdesktop/tree/src/xfce-desktop.c#n1318
Comment 4 David Binderman 2019-06-07 20:20:35 CEST
From:
           /* no icons on the desktop, grab the focus and pop up the menu */
            if(!gtk_widget_has_grab(w))
                gtk_grab_add(w);

            xfce_desktop_popup_root_menu(desktop, button, evt->time);
            return TRUE;

to:


           /* if no icons on the desktop then grab the focus  */
            if(!gtk_widget_has_grab(w))
                gtk_grab_add(w);

            /* pop up the menu */
            xfce_desktop_popup_root_menu(desktop, button, evt->time);
            return TRUE;

No user visible change, but the comments and the code
now match up.
Comment 5 Andre Miranda editbugs 2019-06-09 16:02:13 CEST
The proposed comment actually is more confusing, it's near an if but the condition (no icons on the desktop) is evaluated by the macro.
I think the current comment refers to the whole block (from endif to return), not perfect but correct.
Comment 6 Git Bot editbugs 2019-06-09 16:30:36 CEST
Andre Miranda referenced this bugreport in commit 973df9fe472f9370c6e8c30d2e65553245993455

Fix indentation (Bug #15553)

https://git.xfce.org/xfce/xfdesktop/commit?id=973df9fe472f9370c6e8c30d2e65553245993455

Bug #15553

Reported by:
David Binderman
Reported on: 2019-06-05
Last modified on: 2019-06-09

People

Assignee:
Xfce Bug Triage
CC List:
2 users

Version

Version:
Unspecified

Attachments

Additional information