1
0
Fork 0
mirror of git://git.code.sf.net/p/cdesktopenv/code synced 2025-02-13 11:42:21 +00:00

dtwm: To avoid a segfault, allocate gadget rectangles when regenerate

window frame. A typical case, create a frameless window then regenerate
it's frame.
This commit is contained in:
Liang Chang 2021-08-19 21:49:03 +08:00
parent 8fa32b3db5
commit f05bc54ceb
2 changed files with 4 additions and 2 deletions

View file

@ -989,7 +989,8 @@ int IdentifyFramePart (ClientData *pCD, int x, int y)
if (decor & MWM_DECOR_TITLE)
{
if ( (x >= pCD->titleRectangle.x) &&
if ( pCD->pTitleGadgets &&
(x >= pCD->titleRectangle.x) &&
(x < (int)pCD->titleRectangle.x + (int)pCD->titleRectangle.width) &&
(y >= pCD->titleRectangle.y) &&
(y < (int)pCD->titleRectangle.y + (int)pCD->titleRectangle.height) )
@ -1002,7 +1003,7 @@ int IdentifyFramePart (ClientData *pCD, int x, int y)
/* try resize border */
if (decor & MWM_DECOR_RESIZEH)
if (decor & MWM_DECOR_RESIZEH && pCD->pTitleGadgets)
{
rval = GadgetID(x, y, pCD->pResizeGadgets, STRETCH_COUNT);
}

View file

@ -2335,6 +2335,7 @@ void RegenerateClientFrame (ClientData *pcd)
}
/* recreate gadget rectangles */
AllocateGadgetRectangles (pcd);
ComputeGadgetRectangles (pcd);
/* regenerate the graphics */