summaryrefslogtreecommitdiff
path: root/plugins/pychrysalide/analysis/db/items/comment.c
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/pychrysalide/analysis/db/items/comment.c')
-rw-r--r--plugins/pychrysalide/analysis/db/items/comment.c23
1 files changed, 17 insertions, 6 deletions
diff --git a/plugins/pychrysalide/analysis/db/items/comment.c b/plugins/pychrysalide/analysis/db/items/comment.c
index 28886f5..cae866f 100644
--- a/plugins/pychrysalide/analysis/db/items/comment.c
+++ b/plugins/pychrysalide/analysis/db/items/comment.c
@@ -34,6 +34,7 @@
#include "../item.h"
+#include "../../../access.h"
#include "../../../helpers.h"
#include "../../../arch/vmpa.h"
@@ -224,17 +225,27 @@ PyTypeObject *get_python_db_comment_type(void)
* *
******************************************************************************/
-bool register_python_db_comment(PyObject *module)
+bool ensure_python_db_comment_is_registered(void)
{
- PyTypeObject *py_db_comment_type; /* Type Python 'DbComment' */
+ PyTypeObject *type; /* Type Python 'DbComment' */
+ PyObject *module; /* Module à recompléter */
PyObject *dict; /* Dictionnaire du module */
- py_db_comment_type = get_python_db_comment_type();
+ type = get_python_db_comment_type();
- dict = PyModule_GetDict(module);
+ if (!PyType_HasFeature(type, Py_TPFLAGS_READY))
+ {
+ module = get_access_to_python_module("pychrysalide.analysis.db.items");
+
+ dict = PyModule_GetDict(module);
+
+ if (!ensure_python_db_item_is_registered())
+ return false;
- if (!register_class_for_pygobject(dict, G_TYPE_DB_COMMENT, py_db_comment_type, get_python_db_item_type()))
- return false;
+ if (!register_class_for_pygobject(dict, G_TYPE_DB_COMMENT, type, get_python_db_item_type()))
+ return false;
+
+ }
return true;