diff --git a/compiz-0.7.6-utility-windows.patch b/compiz-0.7.6-utility-windows.patch new file mode 100644 index 0000000..ac2f917 --- /dev/null +++ b/compiz-0.7.6-utility-windows.patch @@ -0,0 +1,18 @@ +diff --git a/src/window.c b/src/window.c + +--- a/src/window.c ++++ b/src/window.c +@@ -2920,7 +2920,10 @@ isGroupTransient (CompWindow *w, + + if (w->transientFor == None || w->transientFor == w->screen->root) + { +- if (w->type & (CompWindowTypeDialogMask | ++ if (w->type & (CompWindowTypeUtilMask | ++ CompWindowTypeToolbarMask | ++ CompWindowTypeMenuMask | ++ CompWindowTypeDialogMask | + CompWindowTypeModalDialogMask)) + { + if (w->clientLeader == clientLeader) + + diff --git a/compiz-0.7.8-mem-leak-fixes.patch b/compiz-0.7.8-mem-leak-fixes.patch new file mode 100644 index 0000000..d7f5840 --- /dev/null +++ b/compiz-0.7.8-mem-leak-fixes.patch @@ -0,0 +1,484 @@ +diff --git a/plugins/blur.c b/plugins/blur.c +index d7da5da..60a1582 100644 +--- a/plugins/blur.c ++++ b/plugins/blur.c +@@ -716,7 +716,7 @@ blurWindowUpdate (CompWindow *w, + XA_INTEGER, &actual, &format, + &n, &left, &propData); + +- if (result == Success && n && propData) ++ if (result == Success && propData) + { + bw->propSet[state] = TRUE; + +diff --git a/plugins/decoration.c b/plugins/decoration.c +index 003685f..3ce3615 100644 +--- a/plugins/decoration.c ++++ b/plugins/decoration.c +@@ -413,9 +413,15 @@ decorCreateDecoration (CompScreen *screen, + XA_INTEGER, &actual, &format, + &n, &nleft, &data); + +- if (result != Success || !n || !data) ++ if (result != Success || !data) + return NULL; + ++ if (!n) ++ { ++ XFree (data); ++ return NULL; ++ } ++ + prop = (long *) data; + + if (decor_property_get_version (prop) != decor_version ()) +@@ -878,19 +884,23 @@ decorCheckForDmOnScreen (CompScreen *s, + XA_WINDOW, &actual, &format, + &n, &left, &data); + +- if (result == Success && n && data) ++ if (result == Success && data) + { +- XWindowAttributes attr; ++ if (n) ++ { ++ XWindowAttributes attr; + +- memcpy (&dmWin, data, sizeof (Window)); +- XFree (data); ++ memcpy (&dmWin, data, sizeof (Window)); + +- compCheckForError (d->display); ++ compCheckForError (d->display); + +- XGetWindowAttributes (d->display, dmWin, &attr); ++ XGetWindowAttributes (d->display, dmWin, &attr); + +- if (compCheckForError (d->display)) +- dmWin = None; ++ if (compCheckForError (d->display)) ++ dmWin = None; ++ } ++ ++ XFree (data); + } + + if (dmWin != ds->dmWin) +diff --git a/plugins/minimize.c b/plugins/minimize.c +index eb82370..1f8a614 100644 +--- a/plugins/minimize.c ++++ b/plugins/minimize.c +@@ -185,23 +185,22 @@ minGetWindowState (CompWindow *w) + int result, format; + unsigned long n, left; + unsigned char *data; ++ int retval = WithdrawnState; + + result = XGetWindowProperty (w->screen->display->display, w->id, + w->screen->display->wmStateAtom, 0L, 1L, FALSE, + w->screen->display->wmStateAtom, + &actual, &format, &n, &left, &data); + +- if (result == Success && n && data) ++ if (result == Success && data) + { +- int state; ++ if (n) ++ memcpy (&retval, data, sizeof (int)); + +- memcpy (&state, data, sizeof (int)); + XFree ((void *) data); +- +- return state; + } + +- return WithdrawnState; ++ return retval; + } + + static int +diff --git a/plugins/switcher.c b/plugins/switcher.c +index 13be8ad..b2d9777 100644 +--- a/plugins/switcher.c ++++ b/plugins/switcher.c +@@ -1056,7 +1056,7 @@ updateForegroundColor (CompScreen *s) + XA_INTEGER, &actual, &format, + &n, &left, &propData); + +- if (result == Success && n && propData) ++ if (result == Success && propData) + { + if (n == 3 || n == 4) + { +diff --git a/plugins/video.c b/plugins/video.c +index b95eb6b..505a974 100644 +--- a/plugins/video.c ++++ b/plugins/video.c +@@ -805,7 +805,7 @@ videoWindowUpdate (CompWindow *w) + XA_INTEGER, &actual, &format, + &n, &left, &propData); + +- if (result == Success && n && propData) ++ if (result == Success && propData) + { + if (n == 13) + { +diff --git a/src/display.c b/src/display.c +index 23b0ba1..dd4676e 100644 +--- a/src/display.c ++++ b/src/display.c +@@ -2767,6 +2767,9 @@ handleSelectionRequest (CompDisplay *display, + event->xselectionrequest.property, + display->atomPairAtom, + 32, PropModeReplace, data, num); ++ ++ if (data) ++ XFree (data); + } + } + else +diff --git a/src/screen.c b/src/screen.c +index 33cb3cc..df7bd18 100644 +--- a/src/screen.c ++++ b/src/screen.c +@@ -977,7 +977,7 @@ updateScreenBackground (CompScreen *screen, + &actualType, &actualFormat, &nItems, + &bytesAfter, &prop); + +- if (status == Success && nItems && prop) ++ if (status == Success && prop) + { + if (actualType == pixmapAtom && + actualFormat == 32 && +@@ -1220,13 +1220,16 @@ getDesktopHints (CompScreen *s) + XA_CARDINAL, &actual, &format, + &n, &left, &propData); + +- if (result == Success && n && propData) ++ if (result == Success && propData) + { +- memcpy (data, propData, sizeof (unsigned long)); +- XFree (propData); ++ if (n) ++ { ++ memcpy (data, propData, sizeof (unsigned long)); + +- if (data[0] > 0 && data[0] < 0xffffffff) +- s->nDesktop = data[0]; ++ if (data[0] > 0 && data[0] < 0xffffffff) ++ s->nDesktop = data[0]; ++ } ++ XFree (propData); + } + + result = XGetWindowProperty (s->display->display, s->root, +@@ -1234,13 +1237,17 @@ getDesktopHints (CompScreen *s) + XA_CARDINAL, &actual, &format, + &n, &left, &propData); + +- if (result == Success && n && propData) ++ if (result == Success && propData) + { +- memcpy (data, propData, sizeof (unsigned long)); +- XFree (propData); ++ if (n) ++ { ++ memcpy (data, propData, sizeof (unsigned long)); + +- if (data[0] < s->nDesktop) +- s->currentDesktop = data[0]; ++ if (data[0] < s->nDesktop) ++ s->currentDesktop = data[0]; ++ } ++ ++ XFree (propData); + } + } + +@@ -1249,7 +1256,7 @@ getDesktopHints (CompScreen *s) + FALSE, XA_CARDINAL, &actual, &format, + &n, &left, &propData); + +- if (result == Success && n && propData) ++ if (result == Success && propData) + { + if (n == 2) + { +@@ -1270,13 +1277,16 @@ getDesktopHints (CompScreen *s) + XA_CARDINAL, &actual, &format, + &n, &left, &propData); + +- if (result == Success && n && propData) ++ if (result == Success && propData) + { +- memcpy (data, propData, sizeof (unsigned long)); +- XFree (propData); ++ if (n) ++ { ++ memcpy (data, propData, sizeof (unsigned long)); + +- if (data[0]) +- (*s->enterShowDesktopMode) (s); ++ if (data[0]) ++ (*s->enterShowDesktopMode) (s); ++ } ++ XFree (propData); + } + + data[0] = s->currentDesktop; +@@ -3406,9 +3416,10 @@ getActiveWindow (CompDisplay *display, + XA_WINDOW, &actual, &format, + &n, &left, &data); + +- if (result == Success && n && data) ++ if (result == Success && data) + { +- memcpy (&w, data, sizeof (Window)); ++ if (n) ++ memcpy (&w, data, sizeof (Window)); + XFree (data); + } + +diff --git a/src/window.c b/src/window.c +index 881bbd5..dfa8bde 100644 +--- a/src/window.c ++++ b/src/window.c +@@ -452,11 +452,12 @@ getClientLeader (CompWindow *w) + 0L, 1L, False, XA_WINDOW, &actual, &format, + &n, &left, &data); + +- if (result == Success && n && data) ++ if (result == Success && data) + { +- Window win; ++ Window win = None; + +- memcpy (&win, data, sizeof (Window)); ++ if (n) ++ memcpy (&win, data, sizeof (Window)); + XFree ((void *) data); + + if (win) +@@ -481,11 +482,12 @@ getStartupId (CompWindow *w) + &actual, &format, + &n, &left, &data); + +- if (result == Success && n && data) ++ if (result == Success && data) + { +- char *id; ++ char *id = NULL; + +- id = strdup ((char *) data); ++ if (n) ++ id = strdup ((char *) data); + XFree ((void *) data); + + return id; +@@ -509,9 +511,10 @@ getWmState (CompDisplay *display, + display->wmStateAtom, &actual, &format, + &n, &left, &data); + +- if (result == Success && n && data) ++ if (result == Success && data) + { +- memcpy (&state, data, sizeof (unsigned long)); ++ if (n) ++ memcpy (&state, data, sizeof (unsigned long)); + XFree ((void *) data); + } + +@@ -908,7 +911,7 @@ unsigned int + getWindowType (CompDisplay *display, + Window id) + { +- Atom actual; ++ Atom actual, a = None; + int result, format; + unsigned long n, left; + unsigned char *data; +@@ -917,13 +920,16 @@ getWindowType (CompDisplay *display, + 0L, 1L, FALSE, XA_ATOM, &actual, &format, + &n, &left, &data); + +- if (result == Success && n && data) ++ if (result == Success && data) + { +- Atom a; ++ if (n) ++ memcpy (&a, data, sizeof (Atom)); + +- memcpy (&a, data, sizeof (Atom)); + XFree ((void *) data); ++ } + ++ if (a) ++ { + if (a == display->winTypeNormalAtom) + return CompWindowTypeNormalMask; + else if (a == display->winTypeMenuAtom) +@@ -1004,7 +1010,7 @@ getMwmHints (CompDisplay *display, + 0L, 20L, FALSE, display->mwmHintsAtom, + &actual, &format, &n, &left, &data); + +- if (result == Success && n && data) ++ if (result == Success && data) + { + MwmHints *mwmHints = (MwmHints *) data; + +@@ -1061,23 +1067,26 @@ getWindowProp (CompDisplay *display, + int result, format; + unsigned long n, left; + unsigned char *data; ++ unsigned int retval = defaultValue; + + result = XGetWindowProperty (display->display, id, property, + 0L, 1L, FALSE, XA_CARDINAL, &actual, &format, + &n, &left, &data); + +- if (result == Success && n && data) ++ if (result == Success && data) + { +- unsigned long value; ++ if (n) ++ { ++ unsigned long value; + +- memcpy (&value, data, sizeof (unsigned long)); ++ memcpy (&value, data, sizeof (unsigned long)); ++ retval = (unsigned int) value; ++ } + + XFree (data); +- +- return (unsigned int) value; + } + +- return defaultValue; ++ return retval; + } + + void +@@ -1103,25 +1112,27 @@ readWindowProp32 (CompDisplay *display, + int result, format; + unsigned long n, left; + unsigned char *data; ++ Bool retval = FALSE; + + result = XGetWindowProperty (display->display, id, property, + 0L, 1L, FALSE, XA_CARDINAL, &actual, &format, + &n, &left, &data); + +- if (result == Success && n && data) ++ if (result == Success && data) + { +- CARD32 value; ++ if (n) ++ { ++ CARD32 value; ++ memcpy (&value, data, sizeof (CARD32)); + +- memcpy (&value, data, sizeof (CARD32)); ++ retval = TRUE; ++ *returnValue = value >> 16; ++ } + + XFree (data); +- +- *returnValue = value >> 16; +- +- return TRUE; + } + +- return FALSE; ++ return retval; + } + + unsigned short +@@ -1696,7 +1707,7 @@ updateWindowStruts (CompWindow *w) + 0L, 12L, FALSE, XA_CARDINAL, &actual, &format, + &n, &left, &data); + +- if (result == Success && n && data) ++ if (result == Success && data) + { + unsigned long *struts = (unsigned long *) data; + +@@ -1742,7 +1753,7 @@ updateWindowStruts (CompWindow *w) + 0L, 4L, FALSE, XA_CARDINAL, + &actual, &format, &n, &left, &data); + +- if (result == Success && n && data) ++ if (result == Success && data) + { + unsigned long *struts = (unsigned long *) data; + +@@ -2673,6 +2684,10 @@ initializeSyncCounter (CompWindow *w) + XSyncDestroyAlarm (w->screen->display->display, w->syncAlarm); + w->syncAlarm = None; + } ++ else if (result == Success && data) ++ { ++ XFree (data); ++ } + + return FALSE; + } +@@ -4657,24 +4672,28 @@ getWindowUserTime (CompWindow *w, + int result, format; + unsigned long n, left; + unsigned char *data; ++ Bool retval = FALSE; + + result = XGetWindowProperty (w->screen->display->display, w->id, + w->screen->display->wmUserTimeAtom, + 0L, 1L, False, XA_CARDINAL, &actual, &format, + &n, &left, &data); + +- if (result == Success && n && data) ++ if (result == Success && data) + { +- CARD32 value; ++ if (n) ++ { ++ CARD32 value; + +- memcpy (&value, data, sizeof (CARD32)); +- XFree ((void *) data); ++ memcpy (&value, data, sizeof (CARD32)); ++ retval = TRUE; ++ *time = (Time) value; ++ } + +- *time = (Time) value; +- return TRUE; ++ XFree ((void *) data); + } + +- return FALSE; ++ return retval; + } + + void +@@ -4937,7 +4956,7 @@ getWindowIcon (CompWindow *w, + &actual, &format, &n, + &left, &data); + +- if (result == Success && n && data) ++ if (result == Success && data) + { + CompIcon **pIcon; + CARD32 *p; +diff --git a/gtk/window-decorator/gtk-window-decorator.c b/gtk/window-decorator/gtk-window-decorator.c +index d018a42..3da0d2e 100644 +--- a/gtk/window-decorator/gtk-window-decorator.c ++++ b/gtk/window-decorator/gtk-window-decorator.c +@@ -2731,7 +2731,7 @@ get_mwm_prop (Window xwindow) + if (err != Success || result != Success) + return decor; + +- if (n && data) ++ if (data) + { + MwmHints *mwm_hints = (MwmHints *) data; + diff --git a/compiz.spec b/compiz.spec index 9e2d302..9d6236f 100644 --- a/compiz.spec +++ b/compiz.spec @@ -62,6 +62,8 @@ Patch106: redhat-logo.patch #Patch110: scale-key.patch # update translations in desktop-effects Patch115: desktop-effects-linguas.patch +Patch116: compiz-0.7.6-utility-windows.patch + # make kde4-window-decorator build against KDE 4.2's libplasma Patch120: compiz-0.7.8-kde42.patch @@ -72,6 +74,9 @@ Patch122: compiz-0.7.8-fullscreen-top.patch # Make sure configuration plugins never get unloaded Patch123: compiz-0.7.8-pin-initial-plugins.patch +# Memory leak fixes from upstream +Patch124: compiz-0.7.8-mem-leak-fixes.patch + %description Compiz is one of the first OpenGL-accelerated compositing window managers for the X Window System. The integration allows it to perform @@ -145,6 +150,8 @@ popd %endif #%patch110 -p1 -b .scale-key +%patch116 -p1 -b .utility + %patch120 -p1 -b .kde42 sleep 1 touch configure @@ -152,6 +159,7 @@ touch configure %patch121 -p1 -b .decoration-placement %patch122 -p1 -b .fullscreen-top %patch123 -p1 -b .initial-plugins +%patch124 -p1 -b .mem-leaks %build rm -rf $RPM_BUILD_ROOT @@ -368,6 +376,10 @@ rm -rf $RPM_BUILD_ROOT %changelog +* Sat Nov 08 2008 Adel Gadllah - 0.7.8-7 +- Readd compiz-0.7.6-utility-windows.patch +- Fix memory leaks + * Thu Dec 04 2008 Adel Gadllah - 0.7.8-6 - Bugfixes from git head: compiz-0.7.8-decoration-placement.patch (RH #218561)