diff options
author | Austin Yuan <shengquan.yuan@intel.com> | 2009-11-23 16:19:36 +0800 |
---|---|---|
committer | Austin Yuan <shengquan.yuan@intel.com> | 2009-11-23 16:19:36 +0800 |
commit | ec0e66e57c4ee66b89a9a886f9d464da5893aac8 (patch) | |
tree | 7e88d7aa3f3115ee550e5d0b5f7b00220113fc21 | |
parent | 2135de7e7c18e3668c2a8f9fc15db6e671fab8df (diff) | |
download | libva-ec0e66e57c4ee66b89a9a886f9d464da5893aac8.tar.gz |
Added a "magic" number to VADisplayContext in case an illeal VA dpy passed in
Signed-off-by: Austin Yuan <shengquan.yuan@intel.com>
-rw-r--r-- | src/va.c | 2 | ||||
-rw-r--r-- | src/va_backend.h | 2 | ||||
-rw-r--r-- | src/x11/va_x11.c | 2 |
3 files changed, 5 insertions, 1 deletions
@@ -58,7 +58,7 @@ static int va_debug_trace = 0; static int vaDisplayIsValid(VADisplay dpy) { VADisplayContextP pDisplayContext = (VADisplayContextP)dpy; - return pDisplayContext && pDisplayContext->vaIsValid(pDisplayContext); + return pDisplayContext && (pDisplayContext->vadpy_magic == 0x789abcde) && pDisplayContext->vaIsValid(pDisplayContext); } static void va_errorMessage(const char *msg, ...) diff --git a/src/va_backend.h b/src/va_backend.h index 6f858f5..e4faa79 100644 --- a/src/va_backend.h +++ b/src/va_backend.h @@ -398,6 +398,8 @@ struct VADriverContext struct VADisplayContext { + int vadpy_magic; + VADisplayContextP pNext; VADriverContextP pDriverContext; diff --git a/src/x11/va_x11.c b/src/x11/va_x11.c index 5908fbe..42adb9e 100644 --- a/src/x11/va_x11.c +++ b/src/x11/va_x11.c @@ -189,6 +189,8 @@ VADisplay vaGetDisplay ( dri_state = calloc(1, sizeof(*dri_state)); if (pDisplayContext && pDriverContext && dri_state) { + pDisplayContext->vadpy_magic = 0x789abcde; + pDriverContext->x11_dpy = native_dpy; pDisplayContext->pNext = pDisplayContexts; pDisplayContext->pDriverContext = pDriverContext; |