summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJosé Fonseca <[email protected]>2009-03-25 21:45:57 +0000
committerJosé Fonseca <[email protected]>2009-03-25 21:47:17 +0000
commit57ea34214c114539a92eafafebf7e7fcfa9fc286 (patch)
tree5c21f5fd4eef9c443f080e9532805f21d9498c32 /src
parente866cd7401e70f1e6494c8adf3983e916c7fa9cf (diff)
trace: Defer the cast to after the check for enabled trace.
Prevents segfault when trace is disabled.
Diffstat (limited to 'src')
-rw-r--r--src/gallium/drivers/trace/tr_context.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/gallium/drivers/trace/tr_context.c b/src/gallium/drivers/trace/tr_context.c
index c8949729047..b69ed2cb526 100644
--- a/src/gallium/drivers/trace/tr_context.c
+++ b/src/gallium/drivers/trace/tr_context.c
@@ -1037,9 +1037,9 @@ struct pipe_context *
trace_context_create(struct pipe_screen *_screen,
struct pipe_context *pipe)
{
- struct trace_screen *tr_scr = trace_screen(_screen);
+ struct trace_screen *tr_scr;
struct trace_context *tr_ctx;
- struct pipe_screen *screen = tr_scr->screen;
+ struct pipe_screen *screen;
if(!pipe)
goto error1;
@@ -1047,6 +1047,9 @@ trace_context_create(struct pipe_screen *_screen,
if(!trace_dump_enabled())
goto error1;
+ tr_scr = trace_screen(_screen);
+ screen = tr_scr->screen;
+
tr_ctx = CALLOC_STRUCT(trace_context);
if(!tr_ctx)
goto error1;