Increase gBufMgr->ref_count after dup2() is done. 29/48229/1
authorYoungJun Cho <yj44.cho@samsung.com>
Wed, 2 Sep 2015 09:57:12 +0000 (18:57 +0900)
committerChangyeon Lee <cyeon.lee@samsung.com>
Wed, 16 Sep 2015 12:06:00 +0000 (21:06 +0900)
Change-Id: I4b9abdb8f80eb611b6bd08412d2290ba5a182095
Signed-off-by: YoungJun Cho <yj44.cho@samsung.com>
src/tbm_bufmgr.c

index 61e5a70..ecf0b0d 100644 (file)
@@ -864,7 +864,6 @@ tbm_bufmgr_init (int fd)
     if (gBufMgr)
     {
         DBG ("[libtbm:%d] use previous gBufMgr\n", getpid());
-        gBufMgr->ref_count++;
 
         if (fd >= 0)
         {
@@ -877,6 +876,7 @@ tbm_bufmgr_init (int fd)
             DBG ("[libtbm:%d] duplicate the drm_fd(%d), new drm_fd(%d).\n",
                         getpid(), gBufMgr->fd, fd);
         }
+        gBufMgr->ref_count++;
 
         DBG ("[libtbm:%d] bufmgr ref: fd=%d, ref_count:%d\n",
                     getpid(), gBufMgr->fd, gBufMgr->ref_count);