void () { PositionMarker positionMarker = myPositionMarker; if (positionMarker != null) { // null it first to avoid accessing invalid marker from other threads myPositionMarker = null; positionMarker.dispose(); } SelectionMarker selectionMarker = mySelectionMarker; if (selectionMarker != null) { mySelectionMarker = null; selectionMarker.dispose(); } isValid = false; myDisposalTrace = new Throwable(); }