[AC-4574] Removing webviews from parent views crashes app
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | n/a |
Status | Closed |
Resolution | Duplicate |
Resolution Date | 2016-10-24T21:17:41.000+0000 |
Affected Version/s | n/a |
Fix Version/s | n/a |
Components | Titanium SDK & CLI |
Labels | defect, ios, iphone |
Reporter | Uhlig Mobile |
Assignee | Shak Hossain |
Created | 2016-10-21T16:24:15.000+0000 |
Updated | 2016-10-24T21:17:41.000+0000 |
Description
When navigating from a view back to another view, if you try and remove a webview from the view you are leaving, the app freezes and then eventually crashes.
Test Case:
index.js
var button1 = Ti.UI.createButton({
height: 50,
width: 100,
backgroundColor: '#00FF00',
color: '#FFF',
top: 50,
title: 'Get View'
});
var firstView = Ti.UI.createView({
backgroundColor: '#CFCFCF'
});
var button2 = Ti.UI.createButton({
backgroundColor: '#000',
color: '#FFF',
height: 50,
width: 100,
title: 'Get WebView'
});
var secondView = Ti.UI.createView();
var button3 = Ti.UI.createButton({
backgroundColor: '#0000FF',
color: '#FFF',
height: 50,
width: 100,
top: 60,
title: 'Go Back'
});
button3.addEventListener( 'click', function( e ) {
var items = firstView.children;
for( var i = 0; i<=items.length; i++ ){
firstView.remove( items[ i ] );
items[ i ] = null;
}
});
var webView = Ti.UI.createWebView({
height : Titanium.UI.SIZE,
width : '100%',
top: 20,
contentHeight : Ti.UI.SIZE,
bottom : 0,
font : Alloy.CFG.FONT_14,
color : '#666',
ignoreSslError : true,
html: '<b>This is only a test. Do not be alarmed.</b>'
});
secondView.add(webView);
secondView.add(button3);
button2.addEventListener( 'click', function( e ) {
firstView.add(secondView);
});
firstView.add( button2 );
button1.addEventListener( 'click', function( e ) {
$.testView.add( firstView );
});
$.testView.add( button1 );
$.index.open();
Process to create bug:
1) Click 'Get View' button
2) Click 'Get WebView' button
3) Click 'Go Back' button
4) Now, click 'Get WebView' button again and app will freeze and then eventually crash.
I cannot reproduce this issue on Android, only iOS.
This is the same issue as AC-4560 but that was marked resolved so I entered another one with the JS being in one file.
Hello, Your other ticket is open. Follow guide in there. You haven't provide a full sample code. Please provide a full sample code that regenerated the issue. In here the code you provided "testView" is not defined. Please provide the test-case in a single JS file so it can be debugged better. But there are some problems with your code as well, for example you are firing the "open" event manually. This is fired by the system. You are also trying to use an open event to a view, but they are only used for window instances. We can validate the issue after the single-file test-case is available, thx!. Please provide the requirements in there. Closing this as duplicate. Thanks.