diff --git a/legacy/ecore/src/lib/ecore/ecore.c b/legacy/ecore/src/lib/ecore/ecore.c index 7fbe943022..5dfe3d6fa0 100644 --- a/legacy/ecore/src/lib/ecore/ecore.c +++ b/legacy/ecore/src/lib/ecore/ecore.c @@ -228,6 +228,12 @@ ecore_shutdown(void) * take a lock here because _ecore_event_shutdown() does callbacks */ _ecore_lock(); + if (_ecore_init_count <= 0) + { + ERR("Init count not greater than 0 in shutdown."); + _ecore_unlock(); + return 0; + } if (--_ecore_init_count != 0) goto unlock; diff --git a/legacy/edje/src/lib/edje_main.c b/legacy/edje/src/lib/edje_main.c index 846daf5087..98b4647a39 100644 --- a/legacy/edje/src/lib/edje_main.c +++ b/legacy/edje/src/lib/edje_main.c @@ -170,6 +170,11 @@ _edje_lib_unref(void) EAPI int edje_shutdown(void) { + if (_edje_init_count <= 0) + { + ERR("Init count not greater than 0 in shutdown."); + return 0; + } if (--_edje_init_count != 0) return _edje_init_count; diff --git a/legacy/eet/src/lib/eet_lib.c b/legacy/eet/src/lib/eet_lib.c index a350d11f3c..bef99b30c0 100644 --- a/legacy/eet/src/lib/eet_lib.c +++ b/legacy/eet/src/lib/eet_lib.c @@ -633,6 +633,11 @@ shutdown_eina: EAPI int eet_shutdown(void) { + if (eet_init_count <= 0) + { + ERR("Init count not greater than 0 in shutdown."); + return 0; + } if (--eet_init_count != 0) return eet_init_count; diff --git a/legacy/eeze/src/lib/eeze_main.c b/legacy/eeze/src/lib/eeze_main.c index e1fe7f0842..b9954cfd31 100644 --- a/legacy/eeze/src/lib/eeze_main.c +++ b/legacy/eeze/src/lib/eeze_main.c @@ -82,6 +82,11 @@ eina_fail: EAPI int eeze_shutdown(void) { + if (_eeze_init_count <= 0) + { + EINA_LOG_ERR("Init count not greater than 0 in shutdown."); + return 0; + } if (--_eeze_init_count != 0) return _eeze_init_count; diff --git a/legacy/efreet/src/lib/efreet.c b/legacy/efreet/src/lib/efreet.c index dde421cd78..42a49d548c 100644 --- a/legacy/efreet/src/lib/efreet.c +++ b/legacy/efreet/src/lib/efreet.c @@ -136,6 +136,11 @@ shutdown_eina: EAPI int efreet_shutdown(void) { + if (_efreet_init_count <= 0) + { + ERR("Init count not greater than 0 in shutdown."); + return 0; + } if (--_efreet_init_count != 0) return _efreet_init_count; diff --git a/legacy/eina/src/lib/eina_main.c b/legacy/eina/src/lib/eina_main.c index 5cf77e726d..2dc9b303ab 100644 --- a/legacy/eina/src/lib/eina_main.c +++ b/legacy/eina/src/lib/eina_main.c @@ -307,6 +307,11 @@ eina_init(void) EAPI int eina_shutdown(void) { + if (_eina_main_count <= 0) + { + ERR("Init count not greater than 0 in shutdown."); + return 0; + } _eina_main_count--; if (EINA_UNLIKELY(_eina_main_count == 0)) { diff --git a/legacy/eio/src/lib/eio_main.c b/legacy/eio/src/lib/eio_main.c index 37ed701969..47ea55bb63 100644 --- a/legacy/eio/src/lib/eio_main.c +++ b/legacy/eio/src/lib/eio_main.c @@ -236,6 +236,11 @@ eio_shutdown(void) Eio_Progress *pg; Eio_File_Associate *asso; + if (_eio_count <= 0) + { + EINA_LOG_ERR("Init count not greater than 0 in shutdown."); + return 0; + } _eio_count--; if (_eio_count > 0) return _eio_count; diff --git a/legacy/embryo/src/lib/embryo_main.c b/legacy/embryo/src/lib/embryo_main.c index 0b01b11141..3c57ec7c37 100644 --- a/legacy/embryo/src/lib/embryo_main.c +++ b/legacy/embryo/src/lib/embryo_main.c @@ -2,6 +2,7 @@ # include "config.h" #endif +#include #include #include @@ -29,6 +30,11 @@ embryo_init(void) EAPI int embryo_shutdown(void) { + if (_embryo_init_count <= 0) + { + printf("%s:%i Init count not greater than 0 in shutdown.", __FUNCTION__, __LINE__); + return 0; + } if (--_embryo_init_count != 0) return _embryo_init_count; diff --git a/legacy/emotion/src/lib/emotion_main.c b/legacy/emotion/src/lib/emotion_main.c index a5e9694b80..74c6eebbd4 100644 --- a/legacy/emotion/src/lib/emotion_main.c +++ b/legacy/emotion/src/lib/emotion_main.c @@ -383,6 +383,11 @@ emotion_shutdown(void) { Emotion_Webcam *ew; + if (_emotion_webcams_count <= 0) + { + EINA_LOG_ERR("Init count not greater than 0 in shutdown."); + return EINA_FALSE; + } if (--_emotion_webcams_count) return EINA_TRUE; EINA_LIST_FREE(_emotion_webcams->webcams, ew) diff --git a/legacy/ethumb/src/lib/ethumb.c b/legacy/ethumb/src/lib/ethumb.c index 07ac716ac7..973f5e657c 100644 --- a/legacy/ethumb/src/lib/ethumb.c +++ b/legacy/ethumb/src/lib/ethumb.c @@ -202,6 +202,11 @@ ethumb_init(void) EAPI int ethumb_shutdown(void) { + if (initcount <= 0) + { + EINA_LOG_ERR("Init count not greater than 0 in shutdown."); + return 0; + } initcount--; if (initcount == 0) { diff --git a/legacy/evas/src/lib/canvas/evas_main.c b/legacy/evas/src/lib/canvas/evas_main.c index b02405d08d..271ccd7d9c 100644 --- a/legacy/evas/src/lib/canvas/evas_main.c +++ b/legacy/evas/src/lib/canvas/evas_main.c @@ -77,6 +77,11 @@ evas_init(void) EAPI int evas_shutdown(void) { + if (_evas_init_count <= 0) + { + EINA_LOG_ERR("Init count not greater than 0 in shutdown."); + return 0; + } if (--_evas_init_count != 0) return _evas_init_count;