Commit 4925f82a authored by Olivier Fourdan's avatar Olivier Fourdan 🛠️
Browse files

frame: Protect XShape requests



Bug: 16383

If the window has vanished, the XShape request will fail.

Make sure all XShape requests are protected by error traps.

Signed-off-by: default avatarOlivier Fourdan <fourdan@xfce.org>

(cherry picked from commit ad33f686)
parent 9ab48f5d
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -475,6 +475,8 @@ frameSetShape (Client * c, int state, FramePixmap * frame_pix, int button_x[BUTT
        return;
    }

    myDisplayErrorTrapPush (display_info);

    if (screen_info->shape_win == None)
    {
        screen_info->shape_win = XCreateSimpleWindow (display_info->dpy, screen_info->xroot, 0, 0, frameWidth (c), frameHeight (c), 0, 0, 0);
@@ -701,6 +703,8 @@ frameSetShape (Client * c, int state, FramePixmap * frame_pix, int button_x[BUTT
    rect.height = frameHeight (c);
    XShapeCombineRectangles (display_info->dpy, screen_info->shape_win, ShapeBounding, 0, 0, &rect, 1, ShapeIntersect, Unsorted);
    XShapeCombineShape (display_info->dpy, c->frame, ShapeBounding, 0, 0, screen_info->shape_win, ShapeBounding, ShapeSet);

    myDisplayErrorTrapPopIgnored (display_info);
}

static void
@@ -1392,6 +1396,8 @@ frameSetShapeInput (Client * c)
        return;
    }

    myDisplayErrorTrapPush (display_info);

    if (screen_info->shape_win == None)
    {
        screen_info->shape_win = XCreateSimpleWindow (display_info->dpy, screen_info->xroot, 0, 0, frameWidth (c), frameHeight (c), 0, 0, 0);
@@ -1406,4 +1412,6 @@ frameSetShapeInput (Client * c)
    XShapeCombineShape(display_info->dpy, screen_info->shape_win, ShapeInput, frameLeft (c), frameTop (c), c->window, ShapeBounding, ShapeSubtract);
    XShapeCombineShape(display_info->dpy, screen_info->shape_win, ShapeInput, frameLeft (c), frameTop (c), c->window, ShapeInput, ShapeUnion);
    XShapeCombineShape(display_info->dpy, c->frame, ShapeInput, 0, 0, screen_info->shape_win, ShapeInput, ShapeSet);

    myDisplayErrorTrapPopIgnored (display_info);
}