Titanium JIRA Archive
Appcelerator Modules (MOD)

[MOD-2452] Ti.Map: Android - Error when closing a window with a map-view

GitHub Issuen/a
TypeImprovement
PriorityMedium
StatusResolved
ResolutionFixed
Resolution Date2018-08-20T20:44:57.000+0000
Affected Version/sn/a
Fix Version/sTi.Map Android 4.3.1
ComponentsMap
Labelsn/a
ReporterHans Knöchel
AssigneeGary Mathews
Created2018-08-12T12:12:06.000+0000
Updated2018-08-20T20:44:57.000+0000

Description

When closing a window with a map view on Android, the following error occurs if the closing-process was done before the map finished loading:
[ERROR] TiApplication: (main) [308,10619] Sending event: exception on thread: main msg:java.lang.NullPointerException: Attempt to invoke virtual method 'boolean org.appcelerator.titanium.proxy.TiViewProxy.fireEvent(java.lang.String, java.lang.Object)' on a null object reference; Titanium 7.2.0,2018/06/07 05:21,undefined
[ERROR] TiApplication: java.lang.NullPointerException: Attempt to invoke virtual method 'boolean org.appcelerator.titanium.proxy.TiViewProxy.fireEvent(java.lang.String, java.lang.Object)' on a null object reference
[ERROR] TiApplication: 	at ti.map.TiUIMapView.onMapLoaded(TiUIMapView.java:1088)
[ERROR] TiApplication: 	at com.google.android.gms.maps.zzj.onMapLoaded(Unknown Source:2)
[ERROR] TiApplication: 	at com.google.android.gms.maps.internal.zzam.onTransact(Unknown Source:10)
[ERROR] TiApplication: 	at android.os.Binder.transact(Binder.java:604)
[ERROR] TiApplication: 	at fb.b(:com.google.android.gms.dynamite_mapsdynamite@12874026@12.8.74 (040700-204998136):20)
[ERROR] TiApplication: 	at com.google.android.gms.maps.internal.bc.a(:com.google.android.gms.dynamite_mapsdynamite@12874026@12.8.74 (040700-204998136):4)
[ERROR] TiApplication: 	at com.google.maps.api.android.lib6.impl.cr.run(:com.google.android.gms.dynamite_mapsdynamite@12874026@12.8.74 (040700-204998136):34)
[ERROR] TiApplication: 	at android.os.Handler.handleCallback(Handler.java:789)
[ERROR] TiApplication: 	at android.os.Handler.dispatchMessage(Handler.java:98)
[ERROR] TiApplication: 	at android.os.Looper.loop(Looper.java:164)
[ERROR] TiApplication: 	at android.app.ActivityThread.main(ActivityThread.java:6541)
[ERROR] TiApplication: 	at java.lang.reflect.Method.invoke(Native Method)
[ERROR] TiApplication: 	at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:240)
[ERROR] TiApplication: 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:767)
It seems like the map listeners are not cleaned up on window-close, so it tried to fire the "complete" event on a proxy that was destroyed already. A proper fix should remove the listener and clean up the map-view instance. A hacky fix could guard if the proxy is null and do not fire the event is so.

Comments

  1. Gary Mathews 2018-08-17

    master: https://github.com/appcelerator-modules/ti.map/pull/242

JSON Source