summaryrefslogtreecommitdiff
path: root/plugins/pychrysalide/format/symbol.c
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/pychrysalide/format/symbol.c')
-rw-r--r--plugins/pychrysalide/format/symbol.c28
1 files changed, 20 insertions, 8 deletions
diff --git a/plugins/pychrysalide/format/symbol.c b/plugins/pychrysalide/format/symbol.c
index d6298d4..d2d1637 100644
--- a/plugins/pychrysalide/format/symbol.c
+++ b/plugins/pychrysalide/format/symbol.c
@@ -35,11 +35,13 @@
#include <format/symbol.h>
+#include "../access.h"
#include "../helpers.h"
#include "../analysis/routine.h"
#include "../analysis/db/items/comment.h"
#include "../arch/instruction.h"
#include "../arch/vmpa.h"
+#include "../glibext/linegen.h"
@@ -435,20 +437,30 @@ PyTypeObject *get_python_binary_symbol_type(void)
* *
******************************************************************************/
-bool register_python_binary_symbol(PyObject *module)
+bool ensure_python_binary_symbol_is_registered(void)
{
- PyTypeObject *py_bin_symbol_type; /* Type Python 'BinSymbol' */
+ PyTypeObject *type; /* Type Python 'BinSymbol' */
+ PyObject *module; /* Module à recompléter */
PyObject *dict; /* Dictionnaire du module */
- py_bin_symbol_type = get_python_binary_symbol_type();
+ type = get_python_binary_symbol_type();
- dict = PyModule_GetDict(module);
+ if (!PyType_HasFeature(type, Py_TPFLAGS_READY))
+ {
+ module = get_access_to_python_module("pychrysalide.format");
+
+ dict = PyModule_GetDict(module);
+
+ if (!ensure_python_line_generator_is_registered())
+ return false;
- if (!register_class_for_pygobject(dict, G_TYPE_BIN_SYMBOL, py_bin_symbol_type, &PyGObject_Type))
- return false;
+ if (!register_class_for_pygobject(dict, G_TYPE_BIN_SYMBOL, type, &PyGObject_Type))
+ return false;
- if (!py_binary_symbol_define_constants(py_bin_symbol_type))
- return false;
+ if (!py_binary_symbol_define_constants(type))
+ return false;
+
+ }
return true;