ecore-x: protect ecore_x_shutdown from creating a negative init count
authorMike Blumenkrantz <zmike@samsung.com>
Wed, 29 May 2019 13:23:23 +0000 (09:23 -0400)
committerWonki Kim <wonki_.kim@samsung.com>
Mon, 3 Jun 2019 07:01:26 +0000 (16:01 +0900)
Summary:
@fix
Depends on D8972

Reviewers: devilhorns

Reviewed By: devilhorns

Subscribers: cedric, #reviewers, #committers

Tags: #efl

Differential Revision: https://phab.enlightenment.org/D8973

src/lib/ecore_x/ecore_x.c

index f3d8cae..500ef19 100644 (file)
@@ -889,6 +889,11 @@ _ecore_x_shutdown2(void)
 EAPI int
 ecore_x_shutdown(void)
 {
+   if (!_ecore_x_init_count)
+     {
+        CRI("Calling ecore_x_shutdown without init! BUG!");
+        return 0;
+     }
    if (--_ecore_x_init_count != 0)
      return _ecore_x_init_count;
    if (_ecore_x_shutdown()) return _ecore_x_init_count;