From 363989ecbaf75829686218091c8d3d9703fa5e6c Mon Sep 17 00:00:00 2001 From: Austin Yuan Date: Wed, 11 Feb 2009 03:39:35 -0500 Subject: [PATCH] Fixed the case that vaXXXX pass a corrupted vaDisplay point Signed-off-by: Austin Yuan --- src/X11/va_x11.c | 22 ++++++++++++++++++++++ src/va.c | 6 +----- 2 files changed, 23 insertions(+), 5 deletions(-) diff --git a/src/X11/va_x11.c b/src/X11/va_x11.c index 7bad12b..61ef2bf 100644 --- a/src/X11/va_x11.c +++ b/src/X11/va_x11.c @@ -154,6 +154,28 @@ static VAStatus va_DisplayContextGetDriverName ( return vaStatus; } +int vaDisplayIsValid(VADisplay dpy) +{ + VADisplayContextP tmp=NULL; + VADisplayContextP pDisplayContext = pDisplayContexts; + + while (pDisplayContext) + { + if (pDisplayContext == (VADisplayContextP)dpy) + { + tmp = (VADisplay)pDisplayContext; + break; + } + pDisplayContext = pDisplayContext->pNext; + } + + if (!tmp) + return 0; + + return tmp->vaIsValid(pDisplayContext); +} + + VADisplay vaGetDisplay ( Display *native_dpy ) diff --git a/src/va.c b/src/va.c index 3e8a799..a38248e 100644 --- a/src/va.c +++ b/src/va.c @@ -51,11 +51,7 @@ static int va_debug_trace = 0; -static int vaDisplayIsValid(VADisplay dpy) -{ - VADisplayContextP pDisplayContext = (VADisplayContextP)dpy; - return pDisplayContext && pDisplayContext->vaIsValid(pDisplayContext); -} +int vaDisplayIsValid(VADisplay dpy); static void va_errorMessage(const char *msg, ...) { -- 2.7.4