feh icon indicating copy to clipboard operation
feh copied to clipboard

Segmentation fault when turn on auto zoom via menu

Open livibetter opened this issue 15 years ago • 2 comments

Since 083a71e948290894e707, the winwid was NULL when I

  • right click to open menu
  • select autozoom (probably all menu option could make winwid has NULL, but I only used autozoom)
  • Segmentation fault
diff --git a/src/events.c b/src/events.c
index 235ad53..48b3cc1 100644
--- a/src/events.c
+++ b/src/events.c
@@ -80,7 +80,7 @@ static void feh_event_handle_ButtonPress(XEvent * ev)
                        winwidget_show_menu(winwid);
                }
        } else if ((ev->xbutton.button == opt.rotate_button)
-                  && (winwid->type != WIN_TYPE_THUMBNAIL)
+                  && (winwid && winwid->type != WIN_TYPE_THUMBNAIL)
                   && ((opt.no_rotate_ctrl_mask)
                       || (ev->xbutton.state & ControlMask))) {
                if (winwid != NULL) {
@@ -89,7 +89,7 @@ static void feh_event_handle_ButtonPress(XEvent * ev)
                        D(("rotate starting at %d, %d\\n", ev->xbutton.x, ev->xb
utton.y));
                }
        } else if ((ev->xbutton.button == opt.blur_button)
-                  && (winwid->type != WIN_TYPE_THUMBNAIL)
+                  && (winwid && winwid->type != WIN_TYPE_THUMBNAIL)
                   && ((opt.no_blur_ctrl_mask)
                       || (ev->xbutton.state & ControlMask))) {
                if (winwid != NULL) {

livibetter avatar Aug 16 '11 04:08 livibetter

This seems to be happening with all menu options - https://bugs.archlinux.org/task/25612

Meyithi avatar Aug 16 '11 19:08 Meyithi

Arg. Yeah, major fail on my side. Thanks for the patch!

derf avatar Aug 16 '11 20:08 derf