Skip to content

Commit

Permalink
set _needs_release = True after a retain call
Browse files Browse the repository at this point in the history
  • Loading branch information
Sam Schott committed Jan 17, 2021
1 parent ae689da commit 764f89f
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions rubicon/objc/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -656,6 +656,17 @@ def __new__(cls, object_ptr, _name=None, _bases=None, _ns=None):

return self

def retain(self):
"""
Manually increment the reference count of the corresponding objc object
The objc object is sent a dealloc message when its reference count reaches 0.
Use this method to retain objects which we don't own.
"""
self._needs_release = True
result = send_message(self, "retain", restype=objc_id, argtypes=[])
return ObjCInstance(result)

def release(self):
"""
Manually decrement the reference count of the corresponding objc object
Expand Down

0 comments on commit 764f89f

Please sign in to comment.