[cogl] x11-tfp: don't call winsys x11_damage_notify without winsys



commit 1f61868fed78457c0da487d2a270804fb70dce8f
Author: Robert Bragg <robert linux intel com>
Date:   Sat Oct 1 16:11:26 2011 +0100

    x11-tfp: don't call winsys x11_damage_notify without winsys
    
    If we failed to create a native texture from pixmap via EGL or GLX then
    we shouldn't call the winsys's texture_pixmap_x11_damage_notify
    function. By doing the validation in cogl-texture-pixmap-x11.c the
    winsys code can continue to assume that it doesn't need to verify there
    is a valid tex_pixmap->winsys pointer.
    
    Thanks to Damien Leone <dleone nvidia com> for catching this issue.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=660184

 cogl/winsys/cogl-texture-pixmap-x11.c |   22 ++++++++++++++--------
 1 files changed, 14 insertions(+), 8 deletions(-)
---
diff --git a/cogl/winsys/cogl-texture-pixmap-x11.c b/cogl/winsys/cogl-texture-pixmap-x11.c
index 90ddbb6..44ac4cd 100644
--- a/cogl/winsys/cogl-texture-pixmap-x11.c
+++ b/cogl/winsys/cogl-texture-pixmap-x11.c
@@ -205,11 +205,14 @@ process_damage_event (CoglTexturePixmapX11 *tex_pixmap,
                                    damage_event->area.height);
     }
 
-  /* If we're using the texture from pixmap extension then there's no
-     point in getting the region and we can just mark that the texture
-     needs updating */
-  winsys = _cogl_texture_pixmap_x11_get_winsys (tex_pixmap);
-  winsys->texture_pixmap_x11_damage_notify (tex_pixmap);
+  if (tex_pixmap->winsys)
+    {
+      /* If we're using the texture from pixmap extension then there's no
+         point in getting the region and we can just mark that the texture
+         needs updating */
+      winsys = _cogl_texture_pixmap_x11_get_winsys (tex_pixmap);
+      winsys->texture_pixmap_x11_damage_notify (tex_pixmap);
+    }
 }
 
 static CoglFilterReturn
@@ -420,7 +423,6 @@ cogl_texture_pixmap_x11_update_area (CoglHandle handle,
                                      int height)
 {
   CoglTexturePixmapX11 *tex_pixmap = COGL_TEXTURE_PIXMAP_X11 (handle);
-  const CoglWinsysVtable *winsys;
 
   if (!cogl_is_texture_pixmap_x11 (handle))
     return;
@@ -429,8 +431,12 @@ cogl_texture_pixmap_x11_update_area (CoglHandle handle,
      texture because we can't determine which will be needed until we
      actually render something */
 
-  winsys = _cogl_texture_pixmap_x11_get_winsys (tex_pixmap);
-  winsys->texture_pixmap_x11_damage_notify (tex_pixmap);
+  if (tex_pixmap->winsys)
+    {
+      const CoglWinsysVtable *winsys;
+      winsys = _cogl_texture_pixmap_x11_get_winsys (tex_pixmap);
+      winsys->texture_pixmap_x11_damage_notify (tex_pixmap);
+    }
 
   cogl_damage_rectangle_union (&tex_pixmap->damage_rect,
                                x, y, width, height);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]