Fix potential use of freed pixmap.
This commit is contained in:
parent
91514a9427
commit
b3d41f5229
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
* Copyright (C) 2000-2007 Carsten Haitzler, Geoff Harrison and various contributors
|
||||
* Copyright (C) 2004-2013 Kim Woelders
|
||||
* Copyright (C) 2004-2014 Kim Woelders
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to
|
||||
|
@ -619,7 +619,7 @@ BackgroundRealize(Background * bg, Win win, Drawable draw, unsigned int rw,
|
|||
#if 0 /* FIXME - Remove? */
|
||||
if (x == 0 && y == 0) /* Hmmm. Always true. */
|
||||
{
|
||||
ESetWindowBackgroundPixmap(draw, pmap);
|
||||
ESetWindowBackgroundPixmap(draw, pmap, 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -715,7 +715,7 @@ BackgroundApplyWin(Background * bg, Win win)
|
|||
BackgroundRealize(bg, win, NoXID, w, h, 1, &pmap, &pixel);
|
||||
if (pmap != NoXID)
|
||||
{
|
||||
ESetWindowBackgroundPixmap(win, pmap);
|
||||
ESetWindowBackgroundPixmap(win, pmap, 0);
|
||||
EImagePixmapsFree(pmap, NoXID);
|
||||
}
|
||||
else
|
||||
|
@ -742,7 +742,7 @@ BackgroundSet(Background * bg, Win win, unsigned int w, unsigned int h)
|
|||
|
||||
bg->pmap = pmap;
|
||||
if (pmap != NoXID)
|
||||
ESetWindowBackgroundPixmap(win, pmap);
|
||||
ESetWindowBackgroundPixmap(win, pmap, 1);
|
||||
else
|
||||
ESetWindowBackground(win, pixel);
|
||||
EClearWindow(win);
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
* Copyright (C) 2000-2007 Carsten Haitzler, Geoff Harrison and various contributors
|
||||
* Copyright (C) 2004-2013 Kim Woelders
|
||||
* Copyright (C) 2004-2014 Kim Woelders
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to
|
||||
|
@ -539,16 +539,16 @@ DeskBackgroundConfigure(Desk * dsk)
|
|||
if (ECompMgrIsActive())
|
||||
{
|
||||
ECompMgrDeskConfigure(dsk);
|
||||
ESetWindowBackgroundPixmap(win, NoXID);
|
||||
ESetWindowBackgroundPixmap(win, NoXID, 0);
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
if (pmap != NoXID)
|
||||
{
|
||||
ESetWindowBackgroundPixmap(win, pmap);
|
||||
ESetWindowBackgroundPixmap(win, pmap, 1);
|
||||
if (dsk->num == 0 && win != VROOT)
|
||||
ESetWindowBackgroundPixmap(VROOT, pmap);
|
||||
ESetWindowBackgroundPixmap(VROOT, pmap, 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -566,9 +566,9 @@ DeskBackgroundConfigure(Desk * dsk)
|
|||
if (!Conf.hints.set_xroot_info_on_root_window)
|
||||
HintsSetRootInfo(EoGetWin(dsk), NoXID, 0);
|
||||
|
||||
ESetWindowBackgroundPixmap(win, NoXID);
|
||||
ESetWindowBackgroundPixmap(win, NoXID, 0);
|
||||
if (dsk->num == 0 && win != VROOT)
|
||||
ESetWindowBackgroundPixmap(VROOT, NoXID);
|
||||
ESetWindowBackgroundPixmap(VROOT, NoXID, 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (C) 2004-2013 Kim Woelders
|
||||
* Copyright (C) 2004-2014 Kim Woelders
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to
|
||||
|
@ -476,7 +476,7 @@ EImageApplyToWin(EImage * im, Win win, int flags, int w, int h)
|
|||
Pixmap pmap, mask;
|
||||
|
||||
EImageRenderPixmaps(im, win, flags, &pmap, &mask, w, h);
|
||||
ESetWindowBackgroundPixmap(win, pmap);
|
||||
ESetWindowBackgroundPixmap(win, pmap, 0);
|
||||
if ((mask != NoXID) || (mask == NoXID && WinIsShaped(win)))
|
||||
EShapeSetMask(win, 0, 0, mask);
|
||||
EImagePixmapsFree(pmap, mask);
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (C) 2003-2013 Kim Woelders
|
||||
* Copyright (C) 2003-2014 Kim Woelders
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to
|
||||
|
@ -483,7 +483,7 @@ EHintsSetDeskInfo(void)
|
|||
if (Mode.wm.exiting && Mode.root.ext_pmap_valid)
|
||||
{
|
||||
HintsSetRootInfo(VROOT, Mode.root.ext_pmap, 0);
|
||||
ESetWindowBackgroundPixmap(VROOT, Mode.root.ext_pmap);
|
||||
ESetWindowBackgroundPixmap(VROOT, Mode.root.ext_pmap, 1);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
* Copyright (C) 2000-2007 Carsten Haitzler, Geoff Harrison and various contributors
|
||||
* Copyright (C) 2004-2013 Kim Woelders
|
||||
* Copyright (C) 2004-2014 Kim Woelders
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to
|
||||
|
@ -92,7 +92,7 @@ HiwinRenderImageInit(Hiwin * phi)
|
|||
ewin->mini_pmm.w, ewin->mini_pmm.h, 0);
|
||||
}
|
||||
|
||||
ESetWindowBackgroundPixmap(EoGetWin(phi), NoXID);
|
||||
ESetWindowBackgroundPixmap(EoGetWin(phi), NoXID, 0);
|
||||
|
||||
/* Reset shape */
|
||||
EShapeSetMask(EoGetWin(phi), 0, 0, NoXID);
|
||||
|
|
|
@ -1167,10 +1167,7 @@ ITApply(Win win, ImageClass * ic, ImageState * is,
|
|||
|
||||
/* Set window pixmap */
|
||||
if (pmap == pmm.pmap)
|
||||
{
|
||||
ESetWindowBackgroundPixmap(win, pmap);
|
||||
EFreeWindowBackgroundPixmap(win);
|
||||
}
|
||||
ESetWindowBackgroundPixmap(win, pmap, 0);
|
||||
|
||||
if (pmm.w == w && pmm.h == h)
|
||||
EShapeSetMask(win, 0, 0, pmm.mask);
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
* Copyright (C) 2000-2007 Carsten Haitzler, Geoff Harrison and various contributors
|
||||
* Copyright (C) 2004-2013 Kim Woelders
|
||||
* Copyright (C) 2004-2014 Kim Woelders
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to
|
||||
|
@ -989,7 +989,7 @@ MenuDrawItem(Menu * m, MenuItem * mi, char shape, int state)
|
|||
}
|
||||
}
|
||||
|
||||
ESetWindowBackgroundPixmap(mi->win, mi_pmm->pmap);
|
||||
ESetWindowBackgroundPixmap(mi->win, mi_pmm->pmap, 1);
|
||||
EShapeSetMask(mi->win, 0, 0, mi_pmm->mask);
|
||||
EClearWindow(mi->win);
|
||||
|
||||
|
|
8
src/x.c
8
src/x.c
|
@ -956,14 +956,14 @@ EConfigureWindow(Win win, unsigned int mask, XWindowChanges * wc)
|
|||
#endif
|
||||
|
||||
void
|
||||
ESetWindowBackgroundPixmap(Win win, Pixmap pmap)
|
||||
ESetWindowBackgroundPixmap(Win win, Pixmap pmap, int kept)
|
||||
{
|
||||
if (!win)
|
||||
return;
|
||||
|
||||
if (win->bgpmap && win->bg_owned)
|
||||
EFreeWindowBackgroundPixmap(win);
|
||||
win->bgpmap = pmap;
|
||||
win->bgpmap = kept ? pmap : NoXID;
|
||||
win->bg_owned = 0; /* Don't manage pixmap */
|
||||
win->bgcol = 0xffffffff; /* Hmmm.. */
|
||||
|
||||
|
@ -985,7 +985,7 @@ EGetWindowBackgroundPixmap(Win win)
|
|||
|
||||
/* Allocate/set new */
|
||||
pmap = ECreatePixmap(win, win->w, win->h, 0);
|
||||
ESetWindowBackgroundPixmap(win, pmap);
|
||||
ESetWindowBackgroundPixmap(win, pmap, 1);
|
||||
win->bg_owned = 1; /* Manage pixmap */
|
||||
|
||||
return pmap;
|
||||
|
@ -999,7 +999,7 @@ EFreeWindowBackgroundPixmap(Win win)
|
|||
|
||||
if (win->bg_owned)
|
||||
EFreePixmap(win->bgpmap);
|
||||
win->bgpmap = 0;
|
||||
win->bgpmap = NoXID;
|
||||
win->bg_owned = 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
* Copyright (C) 2000-2007 Carsten Haitzler, Geoff Harrison and various contributors
|
||||
* Copyright (C) 2004-2013 Kim Woelders
|
||||
* Copyright (C) 2004-2014 Kim Woelders
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to
|
||||
|
@ -178,7 +178,7 @@ int EGetGeometry(Win win, Window * root_return,
|
|||
void EGetWindowAttributes(Win win, XWindowAttributes * pxwa);
|
||||
void EConfigureWindow(Win win, unsigned int mask,
|
||||
XWindowChanges * wc);
|
||||
void ESetWindowBackgroundPixmap(Win win, Pixmap pmap);
|
||||
void ESetWindowBackgroundPixmap(Win win, Pixmap pmap, int kept);
|
||||
Pixmap EGetWindowBackgroundPixmap(Win win);
|
||||
void EFreeWindowBackgroundPixmap(Win win);
|
||||
void ESetWindowBackground(Win win, unsigned int col);
|
||||
|
|
Loading…
Reference in New Issue