diff options
Diffstat (limited to 'plugins/pychrysalide/analysis/contents/encapsulated.c')
-rw-r--r-- | plugins/pychrysalide/analysis/contents/encapsulated.c | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/plugins/pychrysalide/analysis/contents/encapsulated.c b/plugins/pychrysalide/analysis/contents/encapsulated.c index a81e45b..0b604c7 100644 --- a/plugins/pychrysalide/analysis/contents/encapsulated.c +++ b/plugins/pychrysalide/analysis/contents/encapsulated.c @@ -32,6 +32,7 @@ #include "../content.h" +#include "../../access.h" #include "../../helpers.h" @@ -143,17 +144,24 @@ PyTypeObject *get_python_encaps_content_type(void) * * ******************************************************************************/ -bool register_python_encaps_content(PyObject *module) +bool ensure_python_encaps_content_is_registered(void) { - PyTypeObject *py_encaps_content_type; /* Type 'EncapsulatedContent' */ + PyTypeObject *type; /* Type 'EncapsulatedContent' */ + PyObject *module; /* Module à recompléter */ PyObject *dict; /* Dictionnaire du module */ - py_encaps_content_type = get_python_encaps_content_type(); + type = get_python_encaps_content_type(); - dict = PyModule_GetDict(module); + if (!PyType_HasFeature(type, Py_TPFLAGS_READY)) + { + module = get_access_to_python_module("pychrysalide.analysis.contents"); - if (!register_class_for_pygobject(dict, G_TYPE_ENCAPS_CONTENT, py_encaps_content_type, &PyGObject_Type)) - return false; + dict = PyModule_GetDict(module); + + if (!register_class_for_pygobject(dict, G_TYPE_ENCAPS_CONTENT, type, &PyGObject_Type)) + return false; + + } return true; |