gl_generic: Add null checks in some cache functions
authorDerek Foreman <derekf@osg.samsung.com>
Fri, 3 Mar 2017 18:45:58 +0000 (12:45 -0600)
committerDerek Foreman <derekf@osg.samsung.com>
Fri, 3 Mar 2017 19:30:00 +0000 (13:30 -0600)
When wayland session recovery happens, we can end up down this path
with no gl context when elm reprocesses its config file.

That callback fires long before we've re-set up our wayland connection
so we can't possibly have a valid gl context yet.

Prevent that from crashing.

src/modules/evas/engines/gl_generic/evas_engine.c

index d0c179e..4fdcced 100644 (file)
@@ -1399,6 +1399,7 @@ eng_image_cache_flush(void *data)
 
    re->window_use(re->software.ob);
    gl_context = re->window_gl_context_get(re->software.ob);
+   if (!gl_context) return;
 
    tmp_size = evas_common_image_get_cache();
    evas_common_image_set_cache(0);
@@ -1418,7 +1419,7 @@ eng_image_cache_set(void *data, int bytes)
 
    evas_common_image_set_cache(bytes);
    evas_common_rgba_image_scalecache_size_set(bytes);
-   evas_gl_common_image_cache_flush(gl_context);
+   if (gl_context) evas_gl_common_image_cache_flush(gl_context);
 }
 
 static int