possible bug in MapComponent

29 views
Skip to first unread message

romanca...@gmail.com

unread,
Aug 28, 2016, 12:54:57 PM8/28/16
to CodenameOne Discussions
hi! i dont know if i found a bug.

i found that the function fireMapListenerEvent() checks if listeners is not null, but when you remove all the listeners, the variable doesnt become null

    private void fireMapListenerEvent() {
        // assuming always EDT
        if(listeners != null) {
            for(MapListener l : listeners) {
                l.mapPositionUpdated(this, _zoom, getCenter());
            }
        }
    }


 public void removeMapListener(MapListener listener) {
        if(listeners == null) {
            return;
        }
        listeners.remove(listener);
    }

should the removeMapListener set null to the listenes variable if does not have any elements?

thanks

If you are experiencing an issue please mention the full platform your issue applies to:
IDE: NetBeans/Eclipse/IDEA
Desktop OS
Simulator
Device

Shai Almog

unread,
Aug 29, 2016, 1:20:34 AM8/29/16
to CodenameOne Discussions, romanca...@gmail.com
Hi,
this would still work as the listeners collection will be empty.
We are mostly focusing on the native maps and not so much on the map component.
Reply all
Reply to author
Forward
0 new messages