Skip to content

UnregisterListener may not work as expected #140

Description

@tpwalke2

BlueMapAPIConnector.shutdown()'s unregisterListener calls likely no-op
src/main/java/com/tpwalke2/bluemapsignmarkers/core/bluemap/BlueMapAPIConnector.java:41-44

public void shutdown() {
    BlueMapAPI.unregisterListener(this::onEnable);
    BlueMapAPI.unregisterListener(this::onDisable);
}

this::onEnable evaluated here creates a new method-reference object, distinct by identity/default equals
from the this::onEnable passed to BlueMapAPI.onEnable(...) in the constructor (line 37). Unless
BlueMapAPI.unregisterListener does something other than identity/equals-based list removal, this fails to
detach the connector from BlueMap's callbacks — a "shut down" connector keeps reacting to future enable/disable
events. Caveat: confirming this needs the BlueMap API's own listener-registration source, which wasn't in the
review's file set — flagged High rather than Critical for that reason.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions