Skip to content
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): fix crash when setting navTintColor during a view transition #13917

Merged
merged 1 commit into from
Sep 23, 2023

Conversation

hansemannn
Copy link
Collaborator

@hansemannn hansemannn commented Sep 23, 2023

Fixes #13910

After some debugging, it seems like the native TiColor instance that wraps the proposed UIColor can be deallocated, so we explicitly retain it until the color is set async on the UI thread.

Test case:

const win1 = Ti.UI.createWindow({});
win1.add(Ti.UI.createLabel({ text: 'Click', touchEnabled: false }));

const win2 = Ti.UI.createWindow({});

const tab1 = Ti.UI.createTab({ window: win1, title: 'win1' });
const tab2 = Ti.UI.createTab({ window: win2, title: 'win2' });
const tabGroup = Ti.UI.createTabGroup({ tabs: [ tab1, tab2 ] });

tabGroup.open();

win1.addEventListener('click', function () {
	const win3 = Ti.UI.createWindow({ navTintColor: 'red' });
	tabGroup.activeTab.openWindow(win3);

	setTimeout(function () {
		win3.applyProperties({
			navTintColor: 'yellow'
		});
	}, 0);         // <----- 0 = crash, 1000 = no crash
});

@m1ga
Copy link
Contributor

m1ga commented Sep 23, 2023

very nice 👍 Works fine

  • 12.2.0.GA: crash with 0
  • this PR: no crash with 0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

iOS: calling navTintColor twice will crash the app
2 participants