Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-6700] Android: TiActivity - v8/rhino - Console reports activity has leaked window

GitHub Issuen/a
TypeBug
PriorityCritical
StatusClosed
ResolutionFixed
Resolution Date2012-02-14T23:29:05.000+0000
Affected Version/sRelease 1.8.0.1
Fix Version/sSprint 2012-03, Release 2.0.0, Release 1.8.2
ComponentsAndroid
Labelsqe-and121411, qe-testadded, regression
ReporterEric Merriman
AssigneeHieu Pham
Created2011-12-15T12:26:22.000+0000
Updated2012-02-14T23:29:05.000+0000

Description

Description: During a KS pass on v8 on the LG slate and Xoom, pressing "back" on the Phone>Play Movie>Local test outputs the following in the console: E/WindowManager( 812): Activity org.appcelerator.titanium.TiActivity has leaked window com.android.internal.policy.impl.PhoneWindow$DecorView@40fbb588 that was originally added here E/WindowManager( 812): android.view.WindowLeaked: Activity org.appcelerator.titanium.TiActivity has leaked window com.android.internal.policy.impl.PhoneWindow$DecorView@40fbb588 that was originally added here E/WindowManager( 812): at android.view.ViewRoot.(ViewRoot.java:288) E/WindowManager( 812): at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:249) E/WindowManager( 812): at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:193) E/WindowManager( 812): at android.view.WindowManagerImpl$CompatModeWrapper.addView(WindowManagerImpl.java:118) E/WindowManager( 812): at android.view.Window$LocalWindowManager.addView(Window.java:532) E/WindowManager( 812): at android.app.Dialog.show(Dialog.java:269) E/WindowManager( 812): at ti.modules.titanium.ui.widget.TiUIDialog.show(TiUIDialog.java:248) E/WindowManager( 812): at ti.modules.titanium.ui.AlertDialogProxy$1.run(AlertDialogProxy.java:72) E/WindowManager( 812): at android.os.Handler.handleCallback(Handler.java:587) E/WindowManager( 812): at android.os.Handler.dispatchMessage(Handler.java:92) E/WindowManager( 812): at android.os.Looper.loop(Looper.java:132) E/WindowManager( 812): at android.app.ActivityThread.main(ActivityThread.java:4123) E/WindowManager( 812): at java.lang.reflect.Method.invokeNative(Native Method) E/WindowManager( 812): at java.lang.reflect.Method.invoke(Method.java:491) E/WindowManager( 812): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:841) E/WindowManager( 812): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:599) E/WindowManager( 812): at dalvik.system.NativeStart.main(Native Method) D/dalvikvm( 222): GC_EXPLICIT freed 7K, 5% free 20303K/21191K, paused 7ms+2ms Steps to reproduce: 1) Install KS with SDK 1.8.0.1 2) Navigate to Phone>Play Movie>Local 3) Press the back button while examining the console Result: Console logs error Expected: No error in console Note: Does not occur on 175 SDK with KS 175

Comments

  1. Eric Merriman 2011-12-16

    Also occurs on the nook color with SDK: 1.8.0.1.v20111216124633 returning from the Platform Data page. Output:
       E/WindowManager( 2271): Activity org.appcelerator.titanium.TiActivity has leaked window com.android.internal.policy.impl.PhoneWindow$DecorView@4ac1ccb0 that was originally added here
       E/WindowManager( 2271): android.view.WindowLeaked: Activity org.appcelerator.titanium.TiActivity has leaked window com.android.internal.policy.impl.PhoneWindow$DecorView@4ac1ccb0 that was originally added here
       E/WindowManager( 2271): 	at android.view.ViewRoot.<init>(ViewRoot.java:247)
       E/WindowManager( 2271): 	at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:148)
       E/WindowManager( 2271): 	at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:91)
       E/WindowManager( 2271): 	at android.view.Window$LocalWindowManager.addView(Window.java:424)
       E/WindowManager( 2271): 	at android.app.Dialog.show(Dialog.java:241)
       E/WindowManager( 2271): 	at org.appcelerator.kroll.common.TiJSErrorDialog.createDialog(TiJSErrorDialog.java:204)
       E/WindowManager( 2271): 	at org.appcelerator.kroll.common.TiJSErrorDialog$1.onCurrentActivityReady(TiJSErrorDialog.java:104)
       E/WindowManager( 2271): 	at org.appcelerator.titanium.util.TiUIHelper.waitForCurrentActivity(TiUIHelper.java:153)
       E/WindowManager( 2271): 	at org.appcelerator.titanium.TiApplication.waitForCurrentActivity(TiApplication.java:702)
       E/WindowManager( 2271): 	at org.appcelerator.kroll.common.TiJSErrorDialog.handleOpenErrorDialog(TiJSErrorDialog.java:99)
       E/WindowManager( 2271): 	at org.appcelerator.kroll.common.TiJSErrorDialog.handleMessage(TiJSErrorDialog.java:226)
       E/WindowManager( 2271): 	at android.os.Handler.dispatchMessage(Handler.java:95)
       E/WindowManager( 2271): 	at org.appcelerator.kroll.common.TiMessenger.dispatchMessage(TiMessenger.java:318)
       E/WindowManager( 2271): 	at org.appcelerator.kroll.common.TiMessenger.dispatchPendingMessages(TiMessenger.java:303)
       E/WindowManager( 2271): 	at org.appcelerator.kroll.common.TiMessenger$2.getResult(TiMessenger.java:188)
       E/WindowManager( 2271): 	at org.appcelerator.kroll.common.TiMessenger.sendBlockingMessage(TiMessenger.java:215)
       E/WindowManager( 2271): 	at org.appcelerator.kroll.common.TiMessenger.sendBlockingRuntimeMessage(TiMessenger.java:143)
       E/WindowManager( 2271): 	at org.appcelerator.kroll.KrollProxy.fireSyncEvent(KrollProxy.java:417)
       E/WindowManager( 2271): 	at org.appcelerator.titanium.TiBaseActivity.finish(TiBaseActivity.java:817)
       E/WindowManager( 2271): 	at android.app.Activity.onBackPressed(Activity.java:1910)
       E/WindowManager( 2271): 	at android.app.Activity.onKeyUp(Activity.java:1888)
       E/WindowManager( 2271): 	at android.view.KeyEvent.dispatch(KeyEvent.java:1061)
       E/WindowManager( 2271): 	at android.app.Activity.dispatchKeyEvent(Activity.java:2068)
       E/WindowManager( 2271): 	at org.appcelerator.titanium.TiBaseActivity.dispatchKeyEvent(TiBaseActivity.java:499)
       E/WindowManager( 2271): 	at com.android.internal.policy.impl.PhoneWindow$DecorView.dispatchKeyEvent(PhoneWindow.java:1786)
       E/WindowManager( 2271): 	at android.view.ViewRoot.deliverKeyEventToViewHierarchy(ViewRoot.java:2471)
       E/WindowManager( 2271): 	at android.view.ViewRoot.handleFinishedEvent(ViewRoot.java:2441)
       E/WindowManager( 2271): 	at android.view.ViewRoot.handleMessage(ViewRoot.java:1735)
       E/WindowManager( 2271): 	at android.os.Handler.dispatchMessage(Handler.java:99)
       E/WindowManager( 2271): 	at android.os.Looper.loop(Looper.java:123)
       E/WindowManager( 2271): 	at android.app.ActivityThread.main(ActivityThread.java:4627)
       E/WindowManager( 2271): 	at java.lang.reflect.Method.invokeNative(Native Method)
       E/WindowManager( 2271): 	at java.lang.reflect.Method.invoke(Method.java:521)
       E/WindowManager( 2271): 	at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:858)
       E/WindowManager( 2271): 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
       E/WindowManager( 2271): 	at dalvik.system.NativeStart.main(Native Method)
       
  2. Hieu Pham 2012-01-18

    Cannot reproduce with latest master
  3. Eric Merriman 2012-01-18

    I was also unable to reproduce with KS built with SDK 1.9.0.v20120118151633 on a Nexus S. Attempted 10 times.
  4. Natalie Huynh 2012-01-25

    Tested with 1.8.1.v20120124200134 on Droid 3 (2.3.4) run the following code (test came from timob-4947)
       _win = Titanium.UI.createWindow();
       var button1 = Ti.UI.createButton({
          width : 150,
          height : 150,
          title : 'press me!'
       });
       
       button1.addEventListener('click', function() {
       var win = Ti.UI.createWindow({
          modal : true,
          backgroundColor : '#000'
       });
       
       win.addEventListener('close', function() {
          alert('Close event fired');
          Ti.API.info('Close event fired');
       });
       
       var button2 = Ti.UI.createButton({
          width : 150,
          height : 150,
          title : 'Press me!'
       });
       
       button2.addEventListener('click', function() {
          win.close();
       });
       
       win.open();
       win.add(button2);
       });
       
       _win.add(button1);
       _win.open();
       
  5. Eric Merriman 2012-01-25

    Also seen on Rhino KS pass but not by following steps. This was second click to Platform>Platform data so it seems that the area the bug was originally reported in may not be relevant.
       
       D/Window  ( 1117): Loading window with URL: ../examples/platform.js
       D/Module  ( 1117): Loading module: ../examples/platform -> Resources/examples/platform.js
       I/TiAPI   ( 1117): Current Phone Locale is en-US
       I/TiAPI   ( 1117): OS name is android
       I/TiAPI   ( 1117): Runtime: rhino
       I/ActivityManager(  110): Displayed com.appcelerator.titanium/org.appcelerator.titanium.TiActivity: +723ms
       D/dalvikvm(  218): GC_EXPLICIT freed 538K, 54% free 3926K/8519K, external 7605K/7848K, paused 75ms
       W/TiAnalyticsSvc( 1117): (Thread-12) [8902,28683] Analytics Service Started
       I/TiAnalyticsSvc( 1117): (Thread-12) [41,28724] Sending 1 analytics events.
       D/dalvikvm( 1117): GC_CONCURRENT freed 1257K, 39% free 5997K/9735K, external 2544K/3177K, paused 5ms+3ms
       W/TiAnalyticsSvc( 1117): (Thread-12) [980,29704] Stopping Analytics Service
       I/EventLogService(  243): Aggregate from 1327536482218 (log), 1327536482218 (data)
       E/RhinoObject( 1117): (KrollRuntimeThread) [25544,55248] Error: removeListener only takes instances of Function (/tmp/events.js#201)
       E/RhinoObject( 1117): org.mozilla.javascript.JavaScriptException: Error: removeListener only takes instances of Function (/tmp/events.js#201)
       E/RhinoObject( 1117): 	at org.appcelerator.kroll.runtime.rhino.js.events._c_anonymous_8(/tmp/events.js:200)
       E/RhinoObject( 1117): 	at org.appcelerator.kroll.runtime.rhino.js.events.call(/tmp/events.js)
       E/RhinoObject( 1117): 	at org.mozilla.javascript.Interpreter.interpretLoop(Interpreter.java:1701)
       E/RhinoObject( 1117): 	at script(examples/platform.js:14)
       E/RhinoObject( 1117): 	at org.mozilla.javascript.Interpreter.interpret(Interpreter.java:854)
       E/RhinoObject( 1117): 	at org.mozilla.javascript.InterpretedFunction.call(InterpretedFunction.java:164)
       E/RhinoObject( 1117): 	at org.mozilla.javascript.optimizer.OptRuntime.callName(OptRuntime.java:97)
       E/RhinoObject( 1117): 	at org.appcelerator.kroll.runtime.rhino.js.window._c_anonymous_31(/tmp/window.js:467)
       E/RhinoObject( 1117): 	at org.appcelerator.kroll.runtime.rhino.js.window.call(/tmp/window.js)
       E/RhinoObject( 1117): 	at org.mozilla.javascript.ScriptRuntime.applyOrCall(ScriptRuntime.java:2520)
       E/RhinoObject( 1117): 	at org.mozilla.javascript.BaseFunction.execIdCall(BaseFunction.java:300)
       E/RhinoObject( 1117): 	at org.mozilla.javascript.IdFunctionObject.call(IdFunctionObject.java:129)
       E/RhinoObject( 1117): 	at org.mozilla.javascript.optimizer.OptRuntime.call2(OptRuntime.java:76)
       E/RhinoObject( 1117): 	at org.appcelerator.kroll.runtime.rhino.js.events._c_anonymous_2(/tmp/events.js:42)
       E/RhinoObject( 1117): 	at org.appcelerator.kroll.runtime.rhino.js.events.call(/tmp/events.js)
       E/RhinoObject( 1117): 	at org.mozilla.javascript.optimizer.OptRuntime.callN(OptRuntime.java:86)
       E/RhinoObject( 1117): 	at org.appcelerator.kroll.runtime.rhino.js.events._c_anonymous_3(/tmp/events.js:85)
       E/RhinoObject( 1117): 	at org.appcelerator.kroll.runtime.rhino.js.events.call(/tmp/events.js)
       E/RhinoObject( 1117): 	at org.mozilla.javascript.ContextFactory.doTopCall(ContextFactory.java:426)
       E/RhinoObject( 1117): 	at org.mozilla.javascript.ScriptRuntime.doTopCall(ScriptRuntime.java:3177)
       E/RhinoObject( 1117): 	at org.appcelerator.kroll.runtime.rhino.js.events.call(/tmp/events.js)
       E/RhinoObject( 1117): 	at org.appcelerator.kroll.runtime.rhino.RhinoObject.fireEvent(RhinoObject.java:73)
       E/RhinoObject( 1117): 	at org.appcelerator.kroll.KrollProxy.doFireEvent(KrollProxy.java:441)
       E/RhinoObject( 1117): 	at org.appcelerator.kroll.KrollProxy.handleMessage(KrollProxy.java:608)
       E/RhinoObject( 1117): 	at org.appcelerator.titanium.proxy.TiViewProxy.handleMessage(TiViewProxy.java:347)
       E/RhinoObject( 1117): 	at org.appcelerator.titanium.proxy.TiWindowProxy.handleMessage(TiWindowProxy.java:109)
       E/RhinoObject( 1117): 	at ti.modules.titanium.ui.ActivityWindowProxy.handleMessage(ActivityWindowProxy.java:94)
       E/RhinoObject( 1117): 	at android.os.Handler.dispatchMessage(Handler.java:95)
       E/RhinoObject( 1117): 	at android.os.Looper.loop(Looper.java:130)
       E/RhinoObject( 1117): 	at org.appcelerator.kroll.KrollRuntime$KrollRuntimeThread.run(KrollRuntime.java:102)
       E/TiJSError( 1117): (main) [78,55326] ----- Titanium Javascript Runtime Error -----
       E/TiJSError( 1117): (main) [1,55327] - In /tmp/events.js:201,0
       E/TiJSError( 1117): (main) [0,55327] - Message: Error: removeListener only takes instances of Function (/tmp/events.js#201)
       E/TiJSError( 1117): (main) [0,55327] - Source: null
       E/TiBaseActivity( 1117): (main) [254,55581] Layout cleanup.
       E/WindowManager( 1117): Activity org.appcelerator.titanium.TiActivity has leaked window com.android.internal.policy.impl.PhoneWindow$DecorView@40715270 that was originally added here
       E/WindowManager( 1117): android.view.WindowLeaked: Activity org.appcelerator.titanium.TiActivity has leaked window com.android.internal.policy.impl.PhoneWindow$DecorView@40715270 that was originally added here
       E/WindowManager( 1117): 	at android.view.ViewRoot.<init>(ViewRoot.java:258)
       E/WindowManager( 1117): 	at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:148)
       E/WindowManager( 1117): 	at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:91)
       E/WindowManager( 1117): 	at android.view.Window$LocalWindowManager.addView(Window.java:424)
       E/WindowManager( 1117): 	at android.app.Dialog.show(Dialog.java:241)
       E/WindowManager( 1117): 	at org.appcelerator.kroll.common.TiJSErrorDialog.createDialog(TiJSErrorDialog.java:204)
       E/WindowManager( 1117): 	at org.appcelerator.kroll.common.TiJSErrorDialog$1.onCurrentActivityReady(TiJSErrorDialog.java:104)
       E/WindowManager( 1117): 	at org.appcelerator.titanium.util.TiUIHelper.waitForCurrentActivity(TiUIHelper.java:154)
       E/WindowManager( 1117): 	at org.appcelerator.titanium.TiApplication.waitForCurrentActivity(TiApplication.java:702)
       E/WindowManager( 1117): 	at org.appcelerator.kroll.common.TiJSErrorDialog.handleOpenErrorDialog(TiJSErrorDialog.java:99)
       E/WindowManager( 1117): 	at org.appcelerator.kroll.common.TiJSErrorDialog.handleMessage(TiJSErrorDialog.java:226)
       E/WindowManager( 1117): 	at android.os.Handler.dispatchMessage(Handler.java:95)
       E/WindowManager( 1117): 	at org.appcelerator.kroll.common.TiMessenger.dispatchMessage(TiMessenger.java:318)
       E/WindowManager( 1117): 	at org.appcelerator.kroll.common.TiMessenger.dispatchPendingMessages(TiMessenger.java:303)
       E/WindowManager( 1117): 	at org.appcelerator.kroll.common.TiMessenger$2.getResult(TiMessenger.java:188)
       E/WindowManager( 1117): 	at org.appcelerator.kroll.common.TiMessenger.sendBlockingMessage(TiMessenger.java:215)
       E/WindowManager( 1117): 	at org.appcelerator.kroll.common.TiMessenger.sendBlockingRuntimeMessage(TiMessenger.java:143)
       E/WindowManager( 1117): 	at org.appcelerator.kroll.KrollProxy.fireSyncEvent(KrollProxy.java:417)
       E/WindowManager( 1117): 	at org.appcelerator.titanium.TiBaseActivity.finish(TiBaseActivity.java:831)
       E/WindowManager( 1117): 	at android.app.Activity.onBackPressed(Activity.java:1920)
       E/WindowManager( 1117): 	at android.app.Activity.onKeyUp(Activity.java:1898)
       E/WindowManager( 1117): 	at android.view.KeyEvent.dispatch(KeyEvent.java:1280)
       E/WindowManager( 1117): 	at android.app.Activity.dispatchKeyEvent(Activity.java:2078)
       E/WindowManager( 1117): 	at org.appcelerator.titanium.TiBaseActivity.dispatchKeyEvent(TiBaseActivity.java:513)
       E/WindowManager( 1117): 	at com.android.internal.policy.impl.PhoneWindow$DecorView.dispatchKeyEvent(PhoneWindow.java:1663)
       E/WindowManager( 1117): 	at android.view.ViewRoot.deliverKeyEventToViewHierarchy(ViewRoot.java:2560)
       E/WindowManager( 1117): 	at android.view.ViewRoot.handleFinishedEvent(ViewRoot.java:2535)
       E/WindowManager( 1117): 	at android.view.ViewRoot.handleMessage(ViewRoot.java:1867)
       E/WindowManager( 1117): 	at android.os.Handler.dispatchMessage(Handler.java:99)
       E/WindowManager( 1117): 	at android.os.Looper.loop(Looper.java:130)
       E/WindowManager( 1117): 	at android.app.ActivityThread.main(ActivityThread.java:3683)
       E/WindowManager( 1117): 	at java.lang.reflect.Method.invokeNative(Native Method)
       E/WindowManager( 1117): 	at java.lang.reflect.Method.invoke(Method.java:507)
       E/WindowManager( 1117): 	at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
       E/WindowManager( 1117): 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
       E/WindowManager( 1117): 	at dalvik.system.NativeStart.main(Native Method)
       I/TiAPI   ( 1117): FOCUS RECEIVED IN base_ui
       
  6. Eric Merriman 2012-02-07

    Note to QE: This test was added as part of TIMOB-4947.
  7. Eric Merriman 2012-02-07

    Verified fixed with SDK 1.9.0.v20120207000134 and Titanium Studio, build: 1.0.8.201201262211 with both V8 and Rhino using attached sample code from Natalie.

JSON Source