Commit 9c7b3382 authored by droger's avatar droger Committed by Commit bot

Fix crash when using the language picker on iOS

The crash was happening because the wrong constructor of scoped_nsobject,
because the template parameter did not exactly match the declaration.
The automatic conversion to pointer was used, and the crash happened
because the object was not retained.
With the new code, the copy constructor is used instead, as was intended.

Review URL: https://codereview.chromium.org/793463004

Cr-Commit-Position: refs/heads/master@{#311446}
parent b75df192
......@@ -216,15 +216,15 @@ NSTimeInterval kPickerAnimationDurationInSeconds = 0.2;
languagePickerFrame.size.height + navigationBarFrame.size.height;
languagePickerFrame.origin.y += animationHeight;
navigationBarFrame.origin.y += animationHeight;
base::scoped_nsobject<UIView> blockLanguagePicker(_languagePicker);
base::scoped_nsobject<UIView> blockNavigationBar(_navigationBar);
auto blockLanguagePicker(_languagePicker);
auto blockNavigationBar(_navigationBar);
_languagePicker.reset();
_navigationBar.reset();
void (^animations)(void) = ^{
blockLanguagePicker.get().frame = languagePickerFrame;
blockNavigationBar.get().frame = navigationBarFrame;
};
base::scoped_nsobject<UIView> blockSelectionView(_languageSelectionView);
auto blockSelectionView(_languageSelectionView);
_languageSelectionView.reset();
void (^completion)(BOOL finished) = ^(BOOL finished) {
[blockSelectionView removeFromSuperview];
......@@ -336,8 +336,8 @@ NSTimeInterval kPickerAnimationDurationInSeconds = 0.2;
[_languagePicker setBackgroundColor:[infoBarView_ backgroundColor]];
[_languagePicker selectRow:selectedRow inComponent:0 animated:NO];
base::scoped_nsobject<UIView> blockLanguagePicker(_languagePicker);
base::scoped_nsobject<UIView> blockNavigationBar(_navigationBar);
auto blockLanguagePicker(_languagePicker);
auto blockNavigationBar(_navigationBar);
[UIView animateWithDuration:kPickerAnimationDurationInSeconds
animations:^{
blockLanguagePicker.get().frame = finalPickerFrame;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment