From 219ba9cdd960838dd164aa383b2233e44af5337f Mon Sep 17 00:00:00 2001 From: Kai Huuhko Date: Wed, 15 Apr 2015 12:02:34 +0300 Subject: [PATCH] Use atexit to shutdown eo, evas and ecore modules They already had a call to init in the module, thus there was a mismatch not obvious to users. --- efl/ecore/efl.ecore.pyx | 4 +++- efl/eo/efl.eo.pyx | 3 +++ efl/evas/efl.evas.pyx | 3 +++ 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/efl/ecore/efl.ecore.pyx b/efl/ecore/efl.ecore.pyx index 9e421a3..7bb1c3f 100644 --- a/efl/ecore/efl.ecore.pyx +++ b/efl/ecore/efl.ecore.pyx @@ -246,11 +246,12 @@ Classes """ from libc.stdint cimport uintptr_t -import traceback from efl.eo cimport Eo, PY_REFCOUNT from efl.utils.conversions cimport _ctouni from cpython cimport Py_INCREF, Py_DECREF +import traceback +import atexit cdef Eina_Bool _ecore_task_cb(void *data) with gil: @@ -342,6 +343,7 @@ include "efl.ecore_file_download.pxi" include "efl.ecore_file_monitor.pxi" init() +atexit.register(shutdown) #--------------------------------------------------------------------------- diff --git a/efl/eo/efl.eo.pyx b/efl/eo/efl.eo.pyx index 43411a4..d8cdf70 100644 --- a/efl/eo/efl.eo.pyx +++ b/efl/eo/efl.eo.pyx @@ -55,6 +55,8 @@ cdef int PY_REFCOUNT(object o): cdef PyObject *obj = o return obj.ob_refcnt +import atexit + ###################################################################### def init(): @@ -66,6 +68,7 @@ def shutdown(): return eo_shutdown() init() +atexit.register(shutdown) def event_global_freeze_count_get(): cdef int fcount = 0 diff --git a/efl/evas/efl.evas.pyx b/efl/evas/efl.evas.pyx index 2433e28..46fe2db 100644 --- a/efl/evas/efl.evas.pyx +++ b/efl/evas/efl.evas.pyx @@ -965,6 +965,8 @@ from efl.utils.logger cimport add_logger cdef int PY_EFL_EVAS_LOG_DOMAIN = add_logger(__name__).eina_log_domain +import atexit + # TODO doc EVAS_HINT_FILL = -1.0 @@ -1189,3 +1191,4 @@ include "efl.evas_object_grid.pxi" init() +atexit.register(shutdown)