[PATCH 30/31] Sync: Destroy system counters on reset

Daniel Stone daniel at fooishbar.org
Fri Dec 2 03:31:36 PST 2011


When resetting the extension, make sure we also destroy the system
counters we created at ExtensionInit time as well.

Signed-off-by: Daniel Stone <daniel at fooishbar.org>
---
 Xext/sync.c |   20 ++++++++++++++++++++
 1 files changed, 20 insertions(+), 0 deletions(-)

diff --git a/Xext/sync.c b/Xext/sync.c
index 6a0067a..a071635 100644
--- a/Xext/sync.c
+++ b/Xext/sync.c
@@ -111,8 +111,10 @@ static const char *WARN_INVALID_COUNTER_ALARM =
 static void SyncComputeBracketValues(SyncCounter *);
 
 static void SyncInitServerTime(void);
+static void SyncFiniServerTime(void);
 
 static void SyncInitIdleTime(void);
+static void SyncFiniIdleTime(void);
 
 static Bool
 SyncCheckWarnIsCounter(const SyncObject* pSync, const char *warning)
@@ -2553,6 +2555,8 @@ SAlarmNotifyEvent(xSyncAlarmNotifyEvent *from, xSyncAlarmNotifyEvent *to)
 static void
 SyncResetProc(ExtensionEntry *extEntry)
 {
+    SyncFiniServerTime();
+    SyncFiniIdleTime();
     free(SysCounterList);
     SysCounterList = NULL;
     RTCounter = 0;
@@ -2726,6 +2730,14 @@ SyncInitServerTime(void)
     pnext_time = NULL;
 }
 
+static void
+SyncFiniServerTime(void)
+{
+    if (ServertimeCounter)
+        SyncDestroySystemCounter(ServertimeCounter);
+    ServertimeCounter = NULL;
+}
+
 
 
 /*
@@ -2875,3 +2887,11 @@ SyncInitIdleTime (void)
 
     pIdleTimeValueLess = pIdleTimeValueGreater = NULL;
 }
+
+static void
+SyncFiniIdleTime (void)
+{
+    if (IdleTimeCounter)
+        SyncDestroySystemCounter(IdleTimeCounter);
+    IdleTimeCounter = NULL;
+}
-- 
1.7.7.3



More information about the xorg-devel mailing list