From f1b29fbbe71c81ebda166c7e1f38819f22ecb3c5 Mon Sep 17 00:00:00 2001 From: Mike Blumenkrantz Date: Wed, 29 May 2019 09:23:23 -0400 Subject: [PATCH] ecore-x: protect ecore_x_shutdown from creating a negative init count 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 | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/lib/ecore_x/ecore_x.c b/src/lib/ecore_x/ecore_x.c index f3d8caeb20..500ef19f65 100644 --- a/src/lib/ecore_x/ecore_x.c +++ b/src/lib/ecore_x/ecore_x.c @@ -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;