On Tue, Oct 28, 2003 at 12:48:36PM +0100, Frank Gie�ler wrote:
>David Dawes wrote:
>> On Wed, Oct 15, 2003 at 04:17:35PM -0400, David Dawes wrote:
>>
>>>On Wed, Oct 15, 2003 at 12:53:32PM -0400, Mark Vojkovich wrote:
>>>
>>>> Start the server with no clients and access control disabled
>>>>"XFree86 -ac". Run a client and kill it, or run a client that
>>>>terminates itself (like xset) and the server segfaults on the
>>>>server regeneration. I'm having a hard time getting a back trace.
>>>>It looks like the stack is trashed pretty badly. This appears
>>>>to be a recent regression.
>>>
>>>It looks like a malloc/free bug -- maybe a double free somewhere. I
>>>see it crashing in free(), called from CMapUnwrapScreen(). If I add
>>>some debugging ErrorF's the caller of the crashing free() moves. I'll
>>>try a build on FreeBSD and enable some of its malloc debugging flags.
>>
>>
>> That located the problem nicely, aborting at the actual double-free.
>> The screen saver timers get freed in TimerInit() for each generation.
>> However, the timer pointers kept by the screen saver code weren't being
>> cleared for each generation, so the old values kept being used and added
>> back to the timers list. Then they'd get freed again in TimerInit() at
>> the second regeneration. Not to mention that freed memory was still
>> being used. I'm going to commit a fix that clears the Screensaver and
>> DPMS timers at each regeneration.
>>
>> David
>
>Is this fix available as a single patch? I would like to check whether this also
>fixes
>Bugzilla's #776.
cvs rdiff -D "15 October 2003" -D "16 October 2003" Xserver/os
gives:
Index: xc/programs/Xserver/os/WaitFor.c
diff -u xc/programs/Xserver/os/WaitFor.c:3.41 xc/programs/Xserver/os/WaitFor.c:3.42
--- xc/programs/Xserver/os/WaitFor.c:3.41 Thu Sep 25 09:26:27 2003
+++ xc/programs/Xserver/os/WaitFor.c Wed Oct 15 21:33:35 2003
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/os/WaitFor.c,v 3.41 2003/09/25 13:26:27 pascal Exp $
*/
+/* $XFree86: xc/programs/Xserver/os/WaitFor.c,v 3.42 2003/10/16 01:33:35 dawes Exp $
*/
/***********************************************************
Copyright 1987, 1998 The Open Group
@@ -112,7 +112,7 @@
};
static void DoTimer(OsTimerPtr timer, CARD32 now, OsTimerPtr *prev);
-static OsTimerPtr timers;
+static OsTimerPtr timers = NULL;
/*****************
* WaitForSomething:
@@ -568,10 +568,15 @@
}
static OsTimerPtr ScreenSaverTimer = NULL;
+static int ScreenSaverGeneration = -1;
void
SetScreenSaverTimer(void)
{
+ if (ScreenSaverGeneration != serverGeneration) {
+ ScreenSaverTimer = NULL;
+ ScreenSaverGeneration = serverGeneration;
+ }
if (ScreenSaverTime > 0) {
ScreenSaverTimer = TimerSet(ScreenSaverTimer, 0, ScreenSaverTime,
ScreenSaverTimeoutExpire, NULL);
@@ -586,6 +591,7 @@
static OsTimerPtr DPMSStandbyTimer = NULL;
static OsTimerPtr DPMSSuspendTimer = NULL;
static OsTimerPtr DPMSOffTimer = NULL;
+static int DPMSGeneration = -1;
static CARD32
DPMSStandbyTimerExpire(OsTimerPtr timer,CARD32 now,pointer arg)
@@ -635,12 +641,19 @@
if (!DPMSEnabled)
return;
+ if (DPMSGeneration != serverGeneration) {
+ DPMSStandbyTimer = NULL;
+ DPMSSuspendTimer = NULL;
+ DPMSOffTimer = NULL;
+ DPMSGeneration = serverGeneration;
+ }
+
if (DPMSStandbyTime > 0) {
DPMSStandbyTimer = TimerSet(DPMSStandbyTimer, 0, DPMSStandbyTime,
DPMSStandbyTimerExpire, NULL);
}
if (DPMSSuspendTime > 0) {
- DPMSStandbyTimer = TimerSet(DPMSSuspendTimer, 0, DPMSSuspendTime,
+ DPMSSuspendTimer = TimerSet(DPMSSuspendTimer, 0, DPMSSuspendTime,
DPMSSuspendTimerExpire, NULL);
}
if (DPMSOffTime > 0) {
Also, cvsweb.xfree86.org allows easy viewing of changes.
A better approach is to explicitly free the timers at the end of each
generation. I committed that last night.
David
--
David Dawes X-Oz Technologies
www.XFree86.org/~dawes www.x-oz.com
_______________________________________________
Devel mailing list
[EMAIL PROTECTED]
http://XFree86.Org/mailman/listinfo/devel