Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-13099] Android: In a module, using UI component method on callback from a broadcast receiver event causes crash

GitHub Issuen/a
TypeBug
PriorityHigh
StatusClosed
ResolutionInvalid
Resolution Date2013-05-13T20:18:43.000+0000
Affected Version/sRelease 3.0.2
Fix Version/s2013 Sprint 10 Core, 2013 Sprint 10
ComponentsAndroid
LabelsbroadcastReceiver, exalture, module, titanium
ReporterAshish Nigam
Assigneejithinpv
Created2013-03-18T14:22:26.000+0000
Updated2013-11-07T17:57:18.000+0000

Description

App crashes when we create any UI component inside the eventFired from this particular module and trying to access UI component method after pressing back button and launching again. sample app and module code is attached. Steps: 1: Launch the app in android any version (preferred is 4.2 or 2.2). 2: click on Add device button. 3: Click on red view add and an alert will be shown, click ok. 4: press the back button, and app will go in background. 5: launch the app again. 6: Press the Add Device button again. 7: App crashes. Another thing to try. 1: Go to sample app's app.js at line number 71-72 and comment the view1 addEventListener. 2: Launch the app again and now repeat the above process. 3: app won't crash.

Attachments

FileDateSize
addEventListener1.zip2013-03-18T14:22:26.000+0000829983
TestModule.zip2013-03-18T14:22:26.000+00001656149

Comments

  1. jithinpv 2013-04-22

    Cannot reproduce Tested with Titanium Studio, build: 3.0.1.201212181159 Titanium SDK version: 3.1.0 Titanium SDK version: 3.0.2 Android Emulator: Android SDK version: 2.2
  2. Shyam Bhadauria 2013-05-08

    Cannot reproduce the issue each time on android 2.2.2.Once it got reproduced in fourth attempt for 3.0.2.GA build only but never after that. Environment used for verification- SDK - 3.0.2.GA,3.1.0.GA,3.1.1.v20130503173050 Appcelerator studio - 3.1.1.201305031846 Device : LG-P970 Android 2.2.2 But it was reproducible every time on android 4.1 with below environment SDK - 3.0.2.GA,3.1.0.GA,3.1.1.v20130503173050 Appcelerator studio - 3.1.1.201305031846 Device : nexus 7 Android 4.1 Same behaviour as above is shown on titanium studio build : 3.1.0.201304171607.Working fine for android 2.2.2 but crashing on android 4.1.
  3. Allen Yeung 2013-05-13

    This bug is not valid. When using broadcast receivers the runtime needs to be kept alive from the module end. You would need to call something like KrollRuntime.incrementServiceReceiverRefCount(); when registering, and then the corresponding when you want to ungregister the broadcast receiver. Also, there isn't really a need to create a module for broadcast receivers. You can accomplish the same thing with a titanium API: http://docs.appcelerator.com/titanium/latest/#!/api/Titanium.Android.BroadcastReceiver
  4. Shyam Bhadauria 2013-05-14

    Closing it as per the comment by Allen, its being invalid.

JSON Source