Uploaded image for project: 'Titanium SDK/CLI'
  1. Titanium SDK/CLI
  2. TIMOB-12857

mapsv2 Module: NPE crash while using new map while trying to click on and quickly remove annotations

    Details

    • Type: Bug
    • Status: Closed
    • Priority: High
    • Resolution: Fixed
    • Affects Version/s: Release 3.0.2
    • Component/s: None
    • Labels:
    • Environment:

      Mac OS X 10.8.2
      Google Nexus 10
      SDK 3.0.2.GA

      Description

      While testing maps, and hitting the remove annotations button form the test, I got the following log, and the app stopped working. I attempted the same steps but was unable to reproduce the issue. Hieu looked at the code and figured out what was happening and how to repro the bug.

      var win = Ti.UI.createWindow({fullscreen: false});
      var anno = MapModule.createAnnotation({latitude: -33.87365, image: 'map_pin.png', longitude: 151.20689, title: "Sydney", subtitle: "Sydney is quite chill", draggable: true});
      var anno2 = MapModule.createAnnotation({latitude: -33.86365, pincolor: MapModule.ANNOTATION_BLUE, longitude: 151.21689, title: "Anno2", subtitle: "Blue Draggable", draggable: true});
      var anno3 = MapModule.createAnnotation({latitude: -33.85365, longitude: 151.20689, title: "Anno3", subtitle: "Not Draggable", draggable: false});
      var anno4 = MapModule.createAnnotation({latitude: -33.86365, longitude: 151.22689, title: "Anno4", subtitle: "Draggable", draggable: true});
       
      Ti.API.info ("====> Latitude should be: -33.87365 and is: " + anno.latitude);
      Ti.API.info ("====> Longitude should be: 151.20689 and is: " + anno.longitude);
      Ti.API.info ("====> Title should be Sydney and is: " + anno.title);
      Ti.API.info ("====> Draggable should be true and is: " + anno.draggable);
      Ti.API.info ("====> Draggable should be true and is: " + anno.draggable);
       
      var map = MapModule.createView({
      	userLocation: true,
      	mapType: MapModule.NORMAL_TYPE,
      	animate: true,
      	annotations: [anno, anno2, anno4],
      	region: {latitude: -33.87365, longitude: 151.20689, latitudeDelta: 0.1, longitudeDelta: 0.1 }, //Sydney
      	top: '30%'
      });
      Ti.API.info("====> userLocation: " + map.userLocation);
      win.add(map);
       
      var button = Ti.UI.createButton({top: 0, left: 0, title: "Go Mt. View"});
      button.addEventListener('click', function(e) {
      	map.region = {latitude: 37.3689, longitude: -122.0353, latitudeDelta: 0.1, longitudeDelta: 0.1 }; //Mountain View
      });
       
      var button2 = Ti.UI.createButton({top: '10%', title: "add anno3"});
      button2.addEventListener('click', function(e) {
      	map.addAnnotation(anno3);
      });
       
      var button3 = Ti.UI.createButton({top: 0, title: "rm anno3"});
      button3.addEventListener('click', function(e) {
      	map.removeAnnotation(anno3);
      });
       
      var button4 = Ti.UI.createButton({top: '20%', title: "rm all"});
      button4.addEventListener('click', function(e) {
      	map.removeAllAnnotations();
      });
       
      var button5 = Ti.UI.createButton({top: '10%', left: 0, title: "remove annos"});
      button5.addEventListener('click', function(e) {
      	Ti.API.info(anno.getTitle());
      	map.removeAnnotations(["Sydney", anno2]);
      });
       
      var button6 = Ti.UI.createButton({top: 0, right: 0, title: "select anno2"});
      button6.addEventListener('click', function(e) {
      	map.selectAnnotation(anno2);
      });
       
      var button7 = Ti.UI.createButton({top: '10%', right: 0, title: "desel anno2"});
      button7.addEventListener('click', function(e) {
      	map.deselectAnnotation(anno2);
      });
       
      var button8 = Ti.UI.createButton({top: '20%', right: 0, title: "modify anno2"});
      button8.addEventListener('click', function(e) {
      	anno2.title = "Hello";
      	anno2.subtitle = "Hi there.";
      	anno2.longitude = 151.27689;
      });
       
      var button9 = Ti.UI.createButton({top: '20%', left: 0, title: "Add all"});
      button9.addEventListener('click', function(e) {
      	// this was broken TIMOB-12837
      	map.addAnnotations([anno, anno2, anno3, anno4]);
      });
       
      win.add(button);
      win.add(button2);
      win.add(button3);
      win.add(button4);
      win.add(button5);
      win.add(button6);
      win.add(button7);
      win.add(button8);
      win.add(button9);
      win.open();
      

      Steps to reproduce:
      1) Launch test code
      2) click on a pin
      3) Quickly click on the map, then click the "Remove all" button to remove all annotations

      Result:
      The app stops working and the log shows an NPE

      Expected:
      No NPE

      LOG:

      I/TiAPI   ( 2826):  Sydney
      D/AndroidRuntime( 2826): Shutting down VM
      W/dalvikvm( 2826): threadid=1: thread exiting with uncaught exception (group=0x40b5b930)
      E/TiApplication( 2826): (main) [23225,53526] Sending event: exception on thread: main msg:java.lang.NullPointerException; Titanium 3.0.2,2013/02/15 19:02,5a77fe7
      E/TiApplication( 2826): java.lang.NullPointerException
      E/TiApplication( 2826): 	at ti.map.AnnotationProxy.hideInfo(AnnotationProxy.java:196)
      E/TiApplication( 2826): 	at ti.map.TiUIMapView.onMarkerClick(TiUIMapView.java:372)
      E/TiApplication( 2826): 	at com.google.android.gms.maps.GoogleMap$4.f(Unknown Source)
      E/TiApplication( 2826): 	at com.google.android.gms.internal.an$a.onTransact(Unknown Source)
      E/TiApplication( 2826): 	at android.os.Binder.transact(Binder.java:310)
      E/TiApplication( 2826): 	at com.google.android.gms.maps.internal.IOnMarkerClickListener$Stub$Proxy.onMarkerClick(IOnMarkerClickListener.java:84)
      E/TiApplication( 2826): 	at maps.y.bw.a(Unknown Source)
      E/TiApplication( 2826): 	at maps.a.dh.a(Unknown Source)
      E/TiApplication( 2826): 	at maps.a.n.c(Unknown Source)
      E/TiApplication( 2826): 	at maps.a.dw.a(Unknown Source)
      E/TiApplication( 2826): 	at maps.a.bd.c(Unknown Source)
      E/TiApplication( 2826): 	at maps.a.dq.onSingleTapConfirmed(Unknown Source)
      E/TiApplication( 2826): 	at maps.e.v.onSingleTapConfirmed(Unknown Source)
      E/TiApplication( 2826): 	at maps.e.j.handleMessage(Unknown Source)
      E/TiApplication( 2826): 	at android.os.Handler.dispatchMessage(Handler.java:99)
      E/TiApplication( 2826): 	at android.os.Looper.loop(Looper.java:137)
      E/TiApplication( 2826): 	at android.app.ActivityThread.main(ActivityThread.java:5039)
      E/TiApplication( 2826): 	at java.lang.reflect.Method.invokeNative(Native Method)
      E/TiApplication( 2826): 	at java.lang.reflect.Method.invoke(Method.java:511)
      E/TiApplication( 2826): 	at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
      E/TiApplication( 2826): 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
      E/TiApplication( 2826): 	at dalvik.system.NativeStart.main(Native Method)
      E/AndroidRuntime( 2826): FATAL EXCEPTION: main
      E/AndroidRuntime( 2826): java.lang.NullPointerException
      E/AndroidRuntime( 2826): 	at ti.map.AnnotationProxy.hideInfo(AnnotationProxy.java:196)
      E/AndroidRuntime( 2826): 	at ti.map.TiUIMapView.onMarkerClick(TiUIMapView.java:372)
      E/AndroidRuntime( 2826): 	at com.google.android.gms.maps.GoogleMap$4.f(Unknown Source)
      E/AndroidRuntime( 2826): 	at com.google.android.gms.internal.an$a.onTransact(Unknown Source)
      E/AndroidRuntime( 2826): 	at android.os.Binder.transact(Binder.java:310)
      E/AndroidRuntime( 2826): 	at com.google.android.gms.maps.internal.IOnMarkerClickListener$Stub$Proxy.onMarkerClick(IOnMarkerClickListener.java:84)
      E/AndroidRuntime( 2826): 	at maps.y.bw.a(Unknown Source)
      E/AndroidRuntime( 2826): 	at maps.a.dh.a(Unknown Source)
      E/AndroidRuntime( 2826): 	at maps.a.n.c(Unknown Source)
      E/AndroidRuntime( 2826): 	at maps.a.dw.a(Unknown Source)
      E/AndroidRuntime( 2826): 	at maps.a.bd.c(Unknown Source)
      E/AndroidRuntime( 2826): 	at maps.a.dq.onSingleTapConfirmed(Unknown Source)
      E/AndroidRuntime( 2826): 	at maps.e.v.onSingleTapConfirmed(Unknown Source)
      E/AndroidRuntime( 2826): 	at maps.e.j.handleMessage(Unknown Source)
      E/AndroidRuntime( 2826): 	at android.os.Handler.dispatchMessage(Handler.java:99)
      E/AndroidRuntime( 2826): 	at android.os.Looper.loop(Looper.java:137)
      E/AndroidRuntime( 2826): 	at android.app.ActivityThread.main(ActivityThread.java:5039)
      E/AndroidRuntime( 2826): 	at java.lang.reflect.Method.invokeNative(Native Method)
      E/AndroidRuntime( 2826): 	at java.lang.reflect.Method.invoke(Method.java:511)
      E/AndroidRuntime( 2826): 	at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
      E/AndroidRuntime( 2826): 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
      E/AndroidRuntime( 2826): 	at dalvik.system.NativeStart.main(Native Method)
      W/ActivityManager(  388):   Force finishing activity com.appcelerator.mapmod/org.appcelerator.titanium.TiActivity
      W/ActivityManager(  388): Activity pause timeout for ActivityRecord{426a6478 u10 com.appcelerator.mapmod/org.appcelerator.titanium.TiActivity}
      I/Process ( 2826): Sending signal. PID: 2826 SIG: 9
      I/WindowState(  388): WIN DEATH: Window{41793cd0 u10 com.appcelerator.mapmod/com.appcelerator.mapmod.Mapv2moduletestActivity}
      I/ActivityManager(  388): Process com.appcelerator.mapmod (pid 2826) has died.
      W/InputDispatcher(  388): channel '41794078 com.appcelerator.mapmod/org.appcelerator.titanium.TiActivity (server)' ~ Consumer closed input channel or an error occurred.  events=0x9
      E/InputDispatcher(  388): channel '41794078 com.appcelerator.mapmod/org.appcelerator.titanium.TiActivity (server)' ~ Channel is unrecoverably broken and will be disposed!
      

        Attachments

          Activity

            People

            • Assignee:
              hpham Hieu Pham
              Reporter:
              emerriman Eric Merriman
              Reviewer:
              Ping Wang
            • Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Backbone Issue Sync

                • Titanium SDK/CLI <> Titanium Mobile
                  Synced with:
                  TIMOB-15742
                  Sync status:
                  ERROR
                  Last received:
                  Last sent:

                  Git Integration