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

Peter Hutterer peter.hutterer at who-t.net
Tue Dec 6 14:53:11 PST 2011


On Fri, Dec 02, 2011 at 11:31:36AM +0000, Daniel Stone wrote:
> 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>

Reviewed-by: Peter Hutterer <peter.hutterer at who-t.net>



> ---
>  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
> 
> _______________________________________________
> xorg-devel at lists.x.org: X.Org development
> Archives: http://lists.x.org/archives/xorg-devel
> Info: http://lists.x.org/mailman/listinfo/xorg-devel
> 
Cheers,
  Peter


More information about the xorg-devel mailing list