New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(ios): avoid over release of list item proxies #12104
Conversation
|
iphone/Classes/TiUIListView.m
Outdated
@@ -379,7 +379,6 @@ - (void)setDictTemplates_:(id)args | |||
[_measureProxies setObject:cell forKey:key]; | |||
[theProxy setIndexPath:[NSIndexPath indexPathForRow:-1 inSection:-1]]; | |||
[cell release]; | |||
[theProxy release]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@sgtcoolguy I had tried with same changes and it was leaking memory.
avoid explicitly releasing modelDelgate as _destroy handles that and guards against releasing self Fixes TIMOB-28127
4e2418f
to
50e6327
Compare
The change that looks to be involved here dates back to: 46e83b2 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FR Passed: No longer able to reproduce crashes with the above code.
Test Environment
MacOS Big Sur: 11.0 Beta 7
Xcode: 12.0
Java Version: 1.8.0_242
Android NDK: 21.3.6528147
Node.js: 12.18.1
""NPM":"5.0.0","CLI":"8.1.1""
Max OS
iphone 11
JIRA: https://jira.appcelerator.org/browse/TIMOB-28127
Optional Description:
TiProxy is blindly releasing
modelDelegate
in itsdealloc
method. This is a problem for two reasons:_destroy
already handles releasingmodelDelegate
(anddealloc
called_destroy
on the very next line)modelDelegate
may be== self
resulting in the recursivedealloc
that prompts the warning from macOS.This likely affected other proxies that assigned
self
tomodelDelegate
:TiUIListItemProxy
TiUINavBarButton
TiUITableViewRowProxy
TiUITableViewSectionProxy
To reproduce, run this app on macOS target, click label and list view entries multiple times, then let app sit idle in bg for a while to kick in GC:
I suspect it's how we're generating the sections/rows for the
data
property items. The code returns proxies tagged asautorelease
, when I suspect they should not be. The general flow here seems shaky:https://github.com/appcelerator/titanium_mobile/blob/master/iphone/Classes/TiUITableViewProxy.m#L694-L746