]> git.pld-linux.org Git - packages/Mesa.git/blob - intel-fix-invalidate-before-initialisation.diff
- rel 2; intel segfault fix
[packages/Mesa.git] / intel-fix-invalidate-before-initialisation.diff
1 From dd7853f327ad7a286a59c9c5956d4989c31a58fa Mon Sep 17 00:00:00 2001
2 From: Chris Wilson <chris@chris-wilson.co.uk>
3 Date: Fri, 16 Jul 2010 12:24:53 +0100
4 Subject: [PATCH] intel: Fix invalidate before initialisation
5
6 Fixes:
7
8   Bug 29091 - 1.9RC5 server crash when starting GLX 1.3 app with mesa 7.8
9               Intel dri2 driver.
10   https://bugs.freedesktop.org/show_bug.cgi?id=29091
11
12 Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
13 ---
14  src/mesa/drivers/dri/common/dri_util.c    |    2 +-
15  src/mesa/drivers/dri/intel/intel_screen.c |   19 +++++++++++++++----
16  2 files changed, 16 insertions(+), 5 deletions(-)
17
18 diff --git a/src/mesa/drivers/dri/common/dri_util.c b/src/mesa/drivers/dri/common/dri_util.c
19 index 75c9882..9a9bfed 100644
20 --- a/src/mesa/drivers/dri/common/dri_util.c
21 +++ b/src/mesa/drivers/dri/common/dri_util.c
22 @@ -432,7 +432,7 @@ driCreateNewDrawable(__DRIscreen *psp, const __DRIconfig *config,
23       */
24      (void) attrs;
25  
26 -    pdp = malloc(sizeof *pdp);
27 +    pdp = calloc(1, sizeof *pdp);
28      if (!pdp) {
29         return NULL;
30      }
31 diff --git a/src/mesa/drivers/dri/intel/intel_screen.c b/src/mesa/drivers/dri/intel/intel_screen.c
32 index 6e4bb64..083b7bb 100644
33 --- a/src/mesa/drivers/dri/intel/intel_screen.c
34 +++ b/src/mesa/drivers/dri/intel/intel_screen.c
35 @@ -102,10 +102,21 @@ static const __DRItexBufferExtension intelTexBufferExtension = {
36     intelSetTexBuffer2,
37  };
38  
39 +static inline struct intel_context *
40 +to_intel_context(__DRIdrawable *drawable)
41 +{
42 +   if (drawable->driContextPriv == NULL)
43 +      return NULL;
44 +
45 +   return drawable->driContextPriv->driverPrivate;
46 +}
47 +
48  static void
49  intelDRI2Flush(__DRIdrawable *drawable)
50  {
51 -   struct intel_context *intel = drawable->driContextPriv->driverPrivate;
52 +   struct intel_context *intel = to_intel_context(drawable);
53 +   if (!intel)
54 +      return;
55  
56     if (intel->gen < 4)
57        INTEL_FIREVERTICES(intel);
58 @@ -117,9 +128,9 @@ intelDRI2Flush(__DRIdrawable *drawable)
59  static void
60  intelDRI2Invalidate(__DRIdrawable *drawable)
61  {
62 -   struct intel_context *intel = drawable->driContextPriv->driverPrivate;
63 -
64 -   intel->using_dri2_swapbuffers = GL_TRUE;
65 +   struct intel_context *intel = to_intel_context(drawable);
66 +   if (intel)
67 +      intel->using_dri2_swapbuffers = GL_TRUE;
68     dri2InvalidateDrawable(drawable);
69  }
70  
71 -- 
72 1.7.1
73
This page took 0.066826 seconds and 3 git commands to generate.