v1.3.0: fixed toolbar instance persisting when it shouldn't

This commit is contained in:
Evan Debenham
2022-06-24 11:52:44 -04:00
parent 2fe21792d2
commit 9ac770a140

View File

@@ -74,7 +74,13 @@ public class Toolbar extends Component {
height = btnInventory.height();
}
@Override
public synchronized void destroy() {
super.destroy();
if (instance == this) instance = null;
}
@Override
protected void createChildren() {
@@ -406,8 +412,10 @@ public class Toolbar extends Component {
private static CellSelector.Listener informer = new CellSelector.Listener() {
@Override
public void onSelect( Integer cell ) {
instance.examining = false;
GameScene.examineCell( cell );
if (instance != null) {
instance.examining = false;
GameScene.examineCell(cell);
}
}
@Override
public String prompt() {
@@ -527,7 +535,7 @@ public class Toolbar extends Component {
@Override
public synchronized void destroy() {
super.destroy();
SWAP_INSTANCE = null;
if (SWAP_INSTANCE == this) SWAP_INSTANCE = null;
}
@Override