You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
gentoo-overlay/x11-wm/compiz/files/compiz-0.8.4-crash-on-openi...

83 lines
2.0 KiB

From 43c269a377e7b446fb1bb70732835b7395ce9524 Mon Sep 17 00:00:00 2001
From: Danny Baumann <dannybaumann@web.de>
Date: Mon, 25 Jan 2010 06:28:34 +0000
Subject: Fix crash on opening windows.
We must defer match evaluation until window initialization has finished
for all plugins as match evaluation means wrapped function calls.
---
diff --git a/plugins/obs.c b/plugins/obs.c
index a8d67f1..0f5b9d0 100644
--- a/plugins/obs.c
+++ b/plugins/obs.c
@@ -88,6 +88,8 @@ typedef struct _ObsWindow
{
int customFactor[MODIFIER_COUNT];
int matchFactor[MODIFIER_COUNT];
+
+ CompTimeoutHandle updateHandle;
} ObsWindow;
#define GET_OBS_DISPLAY(d) \
@@ -323,6 +325,22 @@ obsMatchPropertyChanged (CompDisplay *d,
WRAP (od, d, matchPropertyChanged, obsMatchPropertyChanged);
}
+static Bool
+obsUpdateWindow (void *closure)
+{
+ CompWindow *w = (CompWindow *) closure;
+ int i;
+
+ OBS_WINDOW (w);
+
+ for (i = 0; i < MODIFIER_COUNT; i++)
+ updatePaintModifier (w, i);
+
+ ow->updateHandle = 0;
+
+ return FALSE;
+}
+
static CompOption *
obsGetDisplayOptions (CompPlugin *p,
CompDisplay *display,
@@ -628,8 +646,8 @@ static CompBool
obsInitWindow (CompPlugin *p,
CompWindow *w)
{
- ObsWindow *ow;
- int i;
+ ObsWindow *ow;
+ int i;
OBS_SCREEN (w->screen);
@@ -643,10 +661,11 @@ obsInitWindow (CompPlugin *p,
ow->matchFactor[i] = 100;
}
- w->base.privates[os->windowPrivateIndex].ptr = ow;
+ /* defer initializing the factors from window matches as match evalution
+ means wrapped function calls */
+ ow->updateHandle = compAddTimeout (0, 0, obsUpdateWindow, w);
- for (i = 0; i < MODIFIER_COUNT; i++)
- updatePaintModifier (w, i);
+ w->base.privates[os->windowPrivateIndex].ptr = ow;
return TRUE;
}
@@ -657,6 +676,9 @@ obsFiniWindow (CompPlugin *p,
{
OBS_WINDOW (w);
+ if (ow->updateHandle)
+ compRemoveTimeout (ow->updateHandle);
+
free (ow);
}
--
cgit v0.8.2