summaryrefslogtreecommitdiff
path: root/python
diff options
context:
space:
mode:
Diffstat (limited to 'python')
-rw-r--r--python/binaryview.py8
-rw-r--r--python/typelibrary.py4
-rw-r--r--python/types.py8
3 files changed, 12 insertions, 8 deletions
diff --git a/python/binaryview.py b/python/binaryview.py
index 3ebe79af..84a415e2 100644
--- a/python/binaryview.py
+++ b/python/binaryview.py
@@ -6293,7 +6293,7 @@ class BinaryView:
obj = core.BNGetAnalysisTypeByName(self.handle, _name)
if not obj:
return None
- return _types.Type.create(obj, platform=self.platform)
+ return _types.Type.create(core.BNNewTypeReference(obj), platform=self.platform)
def get_type_by_id(self, id: str) -> Optional['_types.Type']:
"""
@@ -6314,7 +6314,7 @@ class BinaryView:
obj = core.BNGetAnalysisTypeById(self.handle, id)
if not obj:
return None
- return _types.Type.create(obj, platform=self.platform)
+ return _types.Type.create(core.BNNewTypeReference(obj), platform=self.platform)
def get_type_name_by_id(self, id: str) -> Optional['_types.QualifiedName']:
"""
@@ -6550,7 +6550,7 @@ class BinaryView:
)
if handle is None:
return None
- return _types.Type.create(handle, platform=self.platform)
+ return _types.Type.create(core.BNNewTypeReference(handle), platform=self.platform)
def import_library_object(self, name: str, lib: typelibrary.TypeLibrary = None) -> Optional['_types.Type']:
"""
@@ -6572,7 +6572,7 @@ class BinaryView:
)
if handle is None:
return None
- return _types.Type.create(handle, platform=self.platform)
+ return _types.Type.create(core.BNNewTypeReference(handle), platform=self.platform)
def export_type_to_library(self, lib: typelibrary.TypeLibrary, name: Optional[str], type_obj: StringOrType) -> None:
"""
diff --git a/python/typelibrary.py b/python/typelibrary.py
index 8a56e978..2d2c8fb1 100644
--- a/python/typelibrary.py
+++ b/python/typelibrary.py
@@ -321,7 +321,7 @@ class TypeLibrary:
t = core.BNGetTypeLibraryNamedObject(self.handle, name._to_core_struct())
if t is None:
return None
- return types.Type.create(t)
+ return types.Type.create(core.BNNewTypeReference(t))
def get_named_type(self, name: str) -> Optional[types.Type]:
"""
@@ -337,7 +337,7 @@ class TypeLibrary:
t = core.BNGetTypeLibraryNamedType(self.handle, name._to_core_struct())
if t is None:
return None
- return types.Type.create(t)
+ return types.Type.create(core.BNNewTypeReference(t))
@property
def named_objects(self) -> Dict[str, types.Type]:
diff --git a/python/types.py b/python/types.py
index 2201e6a6..69ab0a8d 100644
--- a/python/types.py
+++ b/python/types.py
@@ -1799,10 +1799,14 @@ class Type:
return MutableTypeBuilder(type.mutable_copy(), bv, name, platform, confidence)
def with_replaced_structure(self, from_struct, to_struct):
- return Type.create(handle=core.BNTypeWithReplacedStructure(self._handle, from_struct.handle, to_struct.handle))
+ handle = core.BNTypeWithReplacedStructure(self._handle, from_struct.handle, to_struct.handle)
+ ref_handle = core.BNNewTypeReference(handle)
+ return Type.create(handle=ref_handle)
def with_replaced_enumeration(self, from_enum, to_enum):
- return Type.create(handle=core.BNTypeWithReplacedEnumeration(self._handle, from_enum.handle, to_enum.handle))
+ handle = core.BNTypeWithReplacedEnumeration(self._handle, from_enum.handle, to_enum.handle)
+ ref_handle = core.BNNewTypeReference(handle)
+ return Type.create(handle=ref_handle)
def with_replaced_named_type_reference(self, from_ref, to_ref):
return Type.create(