ecore_evas_extn: Add safety checks, fixing a crash in elm_test 29/61429/1 accepted/tizen/common/20160310.065054 accepted/tizen/ivi/20160309.004540 accepted/tizen/mobile/20160309.004447 accepted/tizen/tv/20160309.004504 accepted/tizen/wearable/20160309.004522 submit/tizen/20160308.021833
authorJean-Philippe Andre <jp.andre@samsung.com>
Mon, 25 Jan 2016 06:58:16 +0000 (15:58 +0900)
committerWooHyun Jung <wh0705.jung@samsung.com>
Tue, 8 Mar 2016 01:52:37 +0000 (10:52 +0900)
See T2835 (my crash was different from the one reported).

The buffer may be initialized after the first render_pre, due to
whatever timing issue. Check in elm_test "Window Socket" and then
open several "Window Plug".

@fix

Change-Id: Id8740001e8c489f1a3b98d81d39427615f610df0

src/modules/ecore_evas/engines/extn/ecore_evas_extn_buf.c

index 5e0b4f7..692a024 100644 (file)
@@ -118,6 +118,7 @@ _extnbuf_data_get(Extnbuf *b, int *w, int *h, int *stride)
 void *
 _extnbuf_lock(Extnbuf *b, int *w, int *h, int *stride)
 {
+   if (!b) return NULL;
    if (!b->have_lock)
      {
         if (b->lockfd >= 0)
@@ -136,7 +137,7 @@ _extnbuf_lock(Extnbuf *b, int *w, int *h, int *stride)
 void
 _extnbuf_unlock(Extnbuf *b)
 {
-   if (!b->have_lock) return;
+   if (!b || !b->have_lock) return;
    if (b->lockfd >= 0)
      {
         if (lockf(b->lockfd, F_ULOCK, 0) < 0)