diff --git a/changes/256.bugfix.rst b/changes/256.bugfix.rst index 4620765d..5028dcba 100644 --- a/changes/256.bugfix.rst +++ b/changes/256.bugfix.rst @@ -1,2 +1,10 @@ Retain Objective-C objects when creating Python wrappers and release them when the -Python wrapped is garbage collected. +Python wrapped is garbage collected. This means that manual ``retain`` calls and +subsequent ``release`` or ``autorelease`` calls from Python are no longer needed with +very few exceptions such as: + +1. When implementing methods like ``copy`` that are supposed to create an object, if + the returned object is not actually newly created. +2. When dealing with side effects of methods like ``init`` that may release an object + which is still referenced from Python. See for example + https://github.com/beeware/toga/issues/2468. diff --git a/changes/256.removal.rst b/changes/256.removal.rst new file mode 100644 index 00000000..b4a409ac --- /dev/null +++ b/changes/256.removal.rst @@ -0,0 +1,4 @@ +Rubicon no longer skips releasing an Objective-C objects when its Python wrapped is +garbage collected. This means that fewer ``retain`` than ``release`` calls will cause +segfaults on garbage collection. Review your code carefully for unbalanced ``retain`` +and ``release`` calls before updating.