Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-4759] Calling "open" method of already opened heavyweight window crashes application

GitHub Issuen/a
TypeBug
PriorityCritical
StatusClosed
ResolutionFixed
Resolution Date2012-01-31T15:09:02.000+0000
Affected Version/sn/a
Fix Version/sSprint 2012-01, Release 2.0.0, Release 1.8.1
ComponentsAndroid
Labelsmodule_window, parity, qe-testadded
ReporterIvan Skugor
AssigneeNeeraj Gupta
Created2011-07-15T04:47:07.000+0000
Updated2013-12-10T06:18:15.000+0000

Description

Hi all. Let's say that we have heavyweight window that is opened. Calling "open" method of that window crashes application (exception message says: Unable to start activity). Here is source code that demonstrates the issue:
var win = Ti.UI.createWindow({
	modal: true,
	backgroundColor: '#c96'
});

win.open();

win.open();
  462          AndroidRuntime  D  >>>>>>>>>>>>>> AndroidRuntime START <<<<<<<<<<<<<<
  462          AndroidRuntime  D  CheckJNI is ON
  462          AndroidRuntime  D  --- registering native functions ---
   96         ActivityManager  I  Starting activity: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x
                                  10000000 cmp=com.testing.testing7/.Testing7Activity }
  462          AndroidRuntime  D  Shutting down VM
  462                dalvikvm  D  Debugger has detached; object registry had 1 entries
  462          AndroidRuntime  I  NOTE: attach of thread 'Binder Thread #3' failed
   96         ActivityManager  I  Start proc com.testing.testing7 for activity com.testing.testing7/.Testing7Activity: pid=471 uid=10040 g
                                  ids={1015, 3003}
  471           TiApplication  I  (main) [1,1] checkpoint, app created.
  471                dalvikvm  D  GC_FOR_MALLOC freed 2825 objects / 315088 bytes in 68ms
  471           TiApplication  I  (main) [650,651] Titanium 1.7.1 (2011/06/17 00:13 293a6d...)
  471            TiDeployData  D  (main) [47,698] Read deploy data: {"debuggerPort":-1,"debuggerEnabled":false,"fastdevPort":60465}
  471              TiDbHelper  I  (main) [115,813] No value in database for platform key: 'unique_machine_id' returning supplied default '
                                  '
  471              TiDbHelper  I  (main) [18,831] No value in database for platform key: 'hardware_machine_id' returning supplied default 
                                  ''
  471        TiPlatformHelper  E  (main) [1,832] renaming ID
  471          TiRootActivity  I  (main) [1,1] checkpoint, on root activity create, savedInstanceState: null
  471           TiAnalyticsDb  D  (main) [22,23] Creating Database tianalytics.db
  471           TiAnalyticsDb  I  (main) [4,27] Upgrading Database from 1 to 4
  471           TiApplication  E  (main) [320,347] APP PROXY: [Ti.App]
  471                dalvikvm  D  GC_FOR_MALLOC freed 4421 objects / 348992 bytes in 62ms
  471     TiCommonContactsApi  D  (main) [92,439] Using newer contacts api.  Android SDK level: 8
  471                  global  I  Default buffer size used in BufferedReader constructor. It would be better to be explicit if an 8k-char 
                                  buffer is required.
  471                dalvikvm  D  GC_FOR_MALLOC freed 5038 objects / 349864 bytes in 158ms
   96         ActivityManager  I  Process android.process.acore (pid 245) has died.
   38                   qemud  D  fdhandler_accept_event: accepting on fd 10
   38                   qemud  D  created client 0x150b8 listening on fd 15
   38                   qemud  D  client_fd_receive: attempting registration for service 'sensors'
   38                   qemud  D  client_fd_receive:    -> received channel id 8
   38                   qemud  D  client_registration: registration succeeded for client 8
   38                   qemud  D  fdhandler_event: disconnect on fd 15
  471               TiFastDev  D  (kroll$1: app://app.js) [857,1296] Enabling Fastdev on port 60465
  471               TiFastDev  D  (kroll$1: app://app.js) [19,1315] sent tokens successfully
  471               TiFastDev  D  (kroll$1: app://app.js) [2,1317] Fastdev session handshake succesful.
  471               TiFastDev  D  (kroll$1: app://app.js) [53,1370] sent tokens successfully
  471            KrollContext  D  (kroll$1: app://app.js) [4,1374] Running evaluated script: file:///android_asset/Resources/app.js
  471                  global  I  Default buffer size used in BufferedReader constructor. It would be better to be explicit if an 8k-char 
                                  buffer is required.
  471                dalvikvm  D  GC_FOR_MALLOC freed 7232 objects / 482912 bytes in 76ms
   96         ActivityManager  I  Starting activity: Intent { cmp=com.testing.testing7/org.appcelerator.titanium.TiModalActivity (has extr
                                  as) }
  471                  global  I  Default buffer size used in BufferedReader constructor. It would be better to be explicit if an 8k-char 
                                  buffer is required.
  471                dalvikvm  D  GC_FOR_MALLOC freed 5946 objects / 401024 bytes in 61ms
  471          AndroidRuntime  D  Shutting down VM
  471                dalvikvm  W  threadid=1: thread exiting with uncaught exception (group=0x4001d800)
  471       TiUncaughtHandler  E  (main) [707,2081] Sending event: exception on thread: main msg:java.lang.RuntimeException: Unable to sta
                                  rt activity ComponentInfo{com.testing.testing7/com.testing.testing7.Testing7Activity}: java.lang.NullPoi
                                  nterException; Titanium 1.7.1,2011/06/17 00:13,293a6d...
  471       TiUncaughtHandler  E  java.lang.RuntimeException: Unable to start activity ComponentInfo{com.testing.testing7/com.testing.test
                                  ing7.Testing7Activity}: java.lang.NullPointerException
  471       TiUncaughtHandler  E  	at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2663)
  471       TiUncaughtHandler  E  	at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
  471       TiUncaughtHandler  E  	at android.app.ActivityThread.access$2300(ActivityThread.java:125)
  471       TiUncaughtHandler  E  	at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
  471       TiUncaughtHandler  E  	at android.os.Handler.dispatchMessage(Handler.java:99)
  471       TiUncaughtHandler  E  	at android.os.Looper.loop(Looper.java:123)
  471       TiUncaughtHandler  E  	at android.app.ActivityThread.main(ActivityThread.java:4627)
  471       TiUncaughtHandler  E  	at java.lang.reflect.Method.invokeNative(Native Method)
  471       TiUncaughtHandler  E  	at java.lang.reflect.Method.invoke(Method.java:521)
  471       TiUncaughtHandler  E  	at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
  471       TiUncaughtHandler  E  	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
  471       TiUncaughtHandler  E  	at dalvik.system.NativeStart.main(Native Method)
  471       TiUncaughtHandler  E  Caused by: java.lang.NullPointerException
  471       TiUncaughtHandler  E  	at android.content.ComponentName.<init>(ComponentName.java:75)
  471       TiUncaughtHandler  E  	at android.content.Intent.<init>(Intent.java:2678)
  471       TiUncaughtHandler  E  	at ti.modules.titanium.ui.TiUIWindow.createIntent(TiUIWindow.java:527)
  471       TiUncaughtHandler  E  	at ti.modules.titanium.ui.TiUIWindow.createNewActivity(TiUIWindow.java:194)
  471       TiUncaughtHandler  E  	at ti.modules.titanium.ui.TiUIWindow.<init>(TiUIWindow.java:105)
  471       TiUncaughtHandler  E  	at ti.modules.titanium.ui.WindowProxy.handleOpen(WindowProxy.java:99)
  471       TiUncaughtHandler  E  	at org.appcelerator.titanium.proxy.TiWindowProxy.handleMessage(TiWindowProxy.java:86)
  471       TiUncaughtHandler  E  	at ti.modules.titanium.ui.WindowProxy.handleMessage(WindowProxy.java:86)
  471       TiUncaughtHandler  E  	at android.os.Handler.dispatchMessage(Handler.java:95)
  471       TiUncaughtHandler  E  	at org.appcelerator.titanium.TiMessageQueue.dispatchMessage(TiMessageQueue.java:320)
  471       TiUncaughtHandler  E  	at org.appcelerator.titanium.TiMessageQueue.dispatchPendingMessages(TiMessageQueue.java:304)
  471       TiUncaughtHandler  E  	at org.appcelerator.titanium.TiMessageQueue$2.getResult(TiMessageQueue.java:172)
  471       TiUncaughtHandler  E  	at org.appcelerator.titanium.TiMessageQueue.sendBlockingMessage(TiMessageQueue.java:196)
  471       TiUncaughtHandler  E  	at org.appcelerator.titanium.kroll.KrollContext.evalFile(KrollContext.java:277)
  471       TiUncaughtHandler  E  	at org.appcelerator.titanium.kroll.KrollBridge.evalFile(KrollBridge.java:130)
  471       TiUncaughtHandler  E  	at org.appcelerator.titanium.TiContext.evalFile(TiContext.java:190)
  471       TiUncaughtHandler  E  	at org.appcelerator.titanium.TiContext.evalFile(TiContext.java:210)
  471       TiUncaughtHandler  E  	at org.appcelerator.titanium.TiLaunchActivity.loadActivityScript(TiLaunchActivity.java:71)
  471       TiUncaughtHandler  E  	at org.appcelerator.titanium.TiLaunchActivity.windowCreated(TiLaunchActivity.java:112)
  471       TiUncaughtHandler  E  	at org.appcelerator.titanium.TiBaseActivity.onCreate(TiBaseActivity.java:294)
  471       TiUncaughtHandler  E  	at org.appcelerator.titanium.TiLaunchActivity.onCreate(TiLaunchActivity.java:102)
  471       TiUncaughtHandler  E  	at org.appcelerator.titanium.TiRootActivity.onCreate(TiRootActivity.java:38)
  471       TiUncaughtHandler  E  	at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
  471       TiUncaughtHandler  E  	at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2627)
  471       TiUncaughtHandler  E  	... 11 more
  471          AndroidRuntime  E  FATAL EXCEPTION: main
  471          AndroidRuntime  E  java.lang.RuntimeException: Unable to start activity ComponentInfo{com.testing.testing7/com.testing.test
                                  ing7.Testing7Activity}: java.lang.NullPointerException
  471          AndroidRuntime  E  	at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2663)
  471          AndroidRuntime  E  	at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
  471          AndroidRuntime  E  	at android.app.ActivityThread.access$2300(ActivityThread.java:125)
  471          AndroidRuntime  E  	at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
  471          AndroidRuntime  E  	at android.os.Handler.dispatchMessage(Handler.java:99)
  471          AndroidRuntime  E  	at android.os.Looper.loop(Looper.java:123)
  471          AndroidRuntime  E  	at android.app.ActivityThread.main(ActivityThread.java:4627)
  471          AndroidRuntime  E  	at java.lang.reflect.Method.invokeNative(Native Method)
  471          AndroidRuntime  E  	at java.lang.reflect.Method.invoke(Method.java:521)
  471          AndroidRuntime  E  	at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
  471          AndroidRuntime  E  	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
  471          AndroidRuntime  E  	at dalvik.system.NativeStart.main(Native Method)
  471          AndroidRuntime  E  Caused by: java.lang.NullPointerException
  471          AndroidRuntime  E  	at android.content.ComponentName.<init>(ComponentName.java:75)
  471          AndroidRuntime  E  	at android.content.Intent.<init>(Intent.java:2678)
  471          AndroidRuntime  E  	at ti.modules.titanium.ui.TiUIWindow.createIntent(TiUIWindow.java:527)
  471          AndroidRuntime  E  	at ti.modules.titanium.ui.TiUIWindow.createNewActivity(TiUIWindow.java:194)
  471          AndroidRuntime  E  	at ti.modules.titanium.ui.TiUIWindow.<init>(TiUIWindow.java:105)
  471          AndroidRuntime  E  	at ti.modules.titanium.ui.WindowProxy.handleOpen(WindowProxy.java:99)
  471          AndroidRuntime  E  	at org.appcelerator.titanium.proxy.TiWindowProxy.handleMessage(TiWindowProxy.java:86)
  471          AndroidRuntime  E  	at ti.modules.titanium.ui.WindowProxy.handleMessage(WindowProxy.java:86)
  471          AndroidRuntime  E  	at android.os.Handler.dispatchMessage(Handler.java:95)
  471          AndroidRuntime  E  	at org.appcelerator.titanium.TiMessageQueue.dispatchMessage(TiMessageQueue.java:320)
  471          AndroidRuntime  E  	at org.appcelerator.titanium.TiMessageQueue.dispatchPendingMessages(TiMessageQueue.java:304)
  471          AndroidRuntime  E  	at org.appcelerator.titanium.TiMessageQueue$2.getResult(TiMessageQueue.java:172)
  471          AndroidRuntime  E  	at org.appcelerator.titanium.TiMessageQueue.sendBlockingMessage(TiMessageQueue.java:196)
  471          AndroidRuntime  E  	at org.appcelerator.titanium.kroll.KrollContext.evalFile(KrollContext.java:277)
  471          AndroidRuntime  E  	at org.appcelerator.titanium.kroll.KrollBridge.evalFile(KrollBridge.java:130)
  471          AndroidRuntime  E  	at org.appcelerator.titanium.TiContext.evalFile(TiContext.java:190)
  471          AndroidRuntime  E  	at org.appcelerator.titanium.TiContext.evalFile(TiContext.java:210)
  471          AndroidRuntime  E  	at org.appcelerator.titanium.TiLaunchActivity.loadActivityScript(TiLaunchActivity.java:71)
  471          AndroidRuntime  E  	at org.appcelerator.titanium.TiLaunchActivity.windowCreated(TiLaunchActivity.java:112)
  471          AndroidRuntime  E  	at org.appcelerator.titanium.TiBaseActivity.onCreate(TiBaseActivity.java:294)
  471          AndroidRuntime  E  	at org.appcelerator.titanium.TiLaunchActivity.onCreate(TiLaunchActivity.java:102)
  471          AndroidRuntime  E  	at org.appcelerator.titanium.TiRootActivity.onCreate(TiRootActivity.java:38)
  471          AndroidRuntime  E  	at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
  471          AndroidRuntime  E  	at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2627)
  471          AndroidRuntime  E  	... 11 more
   96            ARMAssembler  I  generated scanline__00000077:03515104_00000000_00000000 [ 33 ipp] (47 ins) at [0x375890:0x37594c] in 328
                                  2379 ns
   96         ActivityManager  W  Activity pause timeout for HistoryRecord{44e77150 com.testing.testing7/.Testing7Activity}
   96         ActivityManager  W  Activity idle timeout for HistoryRecord{44e77150 com.testing.testing7/.Testing7Activity}
   96         ActivityManager  W  Activity idle timeout for HistoryRecord{44fdf3d0 com.testing.testing7/org.appcelerator.titanium.TiModalA
                                  ctivity}
  265                dalvikvm  D  GC_EXPLICIT freed 2169 objects / 110744 bytes in 76ms
   96         ActivityManager  W  Timeout executing service: ServiceRecord{45198b90 com.testing.testing7/org.appcelerator.titanium.analyti
                                  cs.TiAnalyticsService}
   96         ActivityManager  I  Crashing app skipping ANR: ProcessRecord{44fa76f8 471:com.testing.testing7/10040} Executing service com.
                                  testing.testing7/org.appcelerator.titanium.analytics.TiAnalyticsService
Comment out "modal: true" and it won't crash.
var win = Ti.UI.createWindow({
	// modal: true,
	backgroundColor: '#c96'
});

win.open();

win.open();
  492          AndroidRuntime  D  >>>>>>>>>>>>>> AndroidRuntime START <<<<<<<<<<<<<<
  492          AndroidRuntime  D  CheckJNI is ON
  492          AndroidRuntime  D  --- registering native functions ---
   96         ActivityManager  I  Starting activity: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x
                                  10000000 cmp=com.testing.testing7/.Testing7Activity }
  492          AndroidRuntime  D  Shutting down VM
  492                dalvikvm  D  Debugger has detached; object registry had 1 entries
   96         ActivityManager  I  Start proc com.testing.testing7 for activity com.testing.testing7/.Testing7Activity: pid=498 uid=10040 g
                                  ids={1015, 3003}
  492          AndroidRuntime  I  NOTE: attach of thread 'Binder Thread #3' failed
   33                dalvikvm  D  GC_EXPLICIT freed 285 objects / 10824 bytes in 587ms
   33                dalvikvm  D  GC_EXPLICIT freed 47 objects / 2080 bytes in 138ms
   33                dalvikvm  D  GC_EXPLICIT freed 2 objects / 64 bytes in 338ms
  498           TiApplication  I  (main) [0,0] checkpoint, app created.
   96     NotificationService  W  Object died trying to hide notification android.app.ITransientNotification$Stub$Proxy@450064d0 in packag
                                  e com.testing.testing7
   96         ActivityManager  W  setProcessForeground called on unknown pid: 471
  498                dalvikvm  D  GC_FOR_MALLOC freed 2852 objects / 316112 bytes in 67ms
  498           TiApplication  I  (main) [671,671] Titanium 1.7.1 (2011/06/17 00:13 293a6d...)
  498            TiDeployData  D  (main) [55,726] Read deploy data: {"debuggerPort":-1,"debuggerEnabled":false,"fastdevPort":60465}
  498        TiPlatformHelper  E  (main) [81,807] renaming ID
  498          TiRootActivity  I  (main) [0,0] checkpoint, on root activity create, savedInstanceState: null
  498           TiApplication  E  (main) [201,201] APP PROXY: [Ti.App]
  498     TiCommonContactsApi  D  (main) [21,222] Using newer contacts api.  Android SDK level: 8
  498                dalvikvm  D  GC_FOR_MALLOC freed 4750 objects / 341744 bytes in 68ms
  498                  global  I  Default buffer size used in BufferedReader constructor. It would be better to be explicit if an 8k-char 
                                  buffer is required.
  498                dalvikvm  D  GC_FOR_MALLOC freed 4743 objects / 332640 bytes in 55ms
   38                   qemud  D  fdhandler_accept_event: accepting on fd 10
   38                   qemud  D  created client 0x150b8 listening on fd 15
   38                   qemud  D  client_fd_receive: attempting registration for service 'sensors'
   38                   qemud  D  client_fd_receive:    -> received channel id 9
   38                   qemud  D  client_registration: registration succeeded for client 9
   38                   qemud  D  fdhandler_event: disconnect on fd 15
  498               TiFastDev  D  (kroll$1: app://app.js) [566,788] Enabling Fastdev on port 60465
  498               TiFastDev  D  (kroll$1: app://app.js) [18,806] sent tokens successfully
  498               TiFastDev  D  (kroll$1: app://app.js) [3,809] Fastdev session handshake succesful.
  498               TiFastDev  D  (kroll$1: app://app.js) [61,870] sent tokens successfully
  498            KrollContext  D  (kroll$1: app://app.js) [3,873] Running evaluated script: file:///android_asset/Resources/app.js
  498          TiRootActivity  I  (main) [0,0] checkpoint, on root activity resume. context = org.appcelerator.titanium.TiContext@44f5c170
                                  
  498          TiAnalyticsSvc  I  (main) [43,43] Send already in progress, skipping intent
  498          TiAnalyticsSvc  W  (Thread-11) [2,45] Analytics Service Started
  498          TiAnalyticsSvc  I  (main) [15,60] Send already in progress, skipping intent
  498          TiAnalyticsSvc  W  (Thread-12) [66,126] Analytics Service Started
  498          TiAnalyticsSvc  W  (Thread-13) [1,127] Analytics Service Started
   96         ActivityManager  I  Displayed activity com.testing.testing7/.Testing7Activity: 4625 ms (total 189518 ms)
  498                dalvikvm  D  GC_FOR_MALLOC freed 6864 objects / 521216 bytes in 275ms
  498          TiAnalyticsSvc  I  (Thread-12) [1643,1770] Sending 4 analytics events.
  498          TiAnalyticsSvc  I  (Thread-11) [16,1786] Sending 4 analytics events.
  498          TiAnalyticsSvc  I  (Thread-13) [17,1803] Sending 4 analytics events.
  498                dalvikvm  D  GC_FOR_MALLOC freed 1025 objects / 205936 bytes in 80ms
  498                dalvikvm  D  GC_FOR_MALLOC freed 5307 objects / 306664 bytes in 82ms
  498          TiAnalyticsSvc  W  (Thread-11) [1431,3234] Stopping Analytics Service
  498                dalvikvm  D  GC_FOR_MALLOC freed 4190 objects / 285272 bytes in 89ms
  498                dalvikvm  D  GC_FOR_MALLOC freed 5038 objects / 450584 bytes in 63ms
  498            NativeCrypto  D  Freeing OpenSSL session
  498          TiAnalyticsSvc  W  (Thread-12) [718,3952] Stopping Analytics Service
  498          TiAnalyticsSvc  W  (Thread-12) [4,3956] Expected to be in a sending state. Sending was already false.
  498          TiAnalyticsSvc  W  (Thread-13) [149,4105] Stopping Analytics Service
  498          TiAnalyticsSvc  W  (Thread-13) [13,4118] Expected to be in a sending state. Sending was already false.
  265                dalvikvm  D  GC_EXPLICIT freed 411 objects / 23200 bytes in 72ms
If you need more info, please let me know.

Comments

  1. Ivan Skugor 2011-07-19

    Related Q/A issue: http://developer.appcelerator.com/question/122788/android-opening-a-heavyweight-window-crashes-emulator
  2. Paul Dowsett 2011-07-25

    Ivan Please always include the console log, if any exceptions are generated. I have corrected your ticket. Please read [Jira Ticket Checklist](http://wiki.appcelerator.org/display/guides/Contributing+to+Titanium#ContributingtoTitanium-Summary%3AJiraTicketChecklist) for future tickets. Thanks
  3. Ivan Skugor 2012-01-11

    Latest 1.9 build (Titanium SDK version: 1.9.0 (01/10/12 17:01 4cb7aff)) does not have this issue (tested with heavyweight and lightweight window), so it can be closed.
  4. Neeraj Gupta 2012-01-11

    This issue appears to be fixed as part of another bug fix. Bug reporter has verified the fix with the latest build so marking it resolved.
  5. Wilson Luu 2012-01-13

    Closing bug. Verified fix on: SDK build: 1.9.0.v20120112153134 Runtime: V8, Rhino Titanium Studio, build: 1.0.8.201201122152 Device: Droid 3 (2.3.4)
  6. Shameer Jan 2013-12-10

    Anvil testcase PR https://github.com/appcelerator/titanium_mobile/pull/4967

JSON Source