summaryrefslogtreecommitdiff
path: root/plugins/pychrysalide/analysis/db/items/comment.c
diff options
context:
space:
mode:
authorCyrille Bagard <nocbos@gmail.com>2018-08-16 09:16:53 (GMT)
committerCyrille Bagard <nocbos@gmail.com>2018-08-16 09:16:53 (GMT)
commitfb315963527f6412273829f09513325e446eb6c9 (patch)
tree361f19767812a8f758545e8daa2973fe0b3c9de7 /plugins/pychrysalide/analysis/db/items/comment.c
parent36945bffa2ca648b58c99905ebf9b1b536a9188a (diff)
Reorganized the Python plugin code.
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;