v0.6.4: various bugfixes:

- fixed corrupted mimics causing save/load crashes
- fixed crashes when destroy is called on the same group twice
- syncronized texture cache methods
- added safety checks to
  - SummoningTrap
  - WaterOfHealth
  - WndAlchemy
  - WndBag
This commit is contained in:
Evan Debenham
2018-03-20 21:13:10 -04:00
parent 4c3709a9d9
commit 8ff3db2088
7 changed files with 28 additions and 20 deletions

View File

@@ -44,7 +44,7 @@ public class TextureCache {
bitmapOptions.inPreferredConfig = Bitmap.Config.ARGB_8888;
}
public static SmartTexture createSolid( int color ) {
public synchronized static SmartTexture createSolid( int color ) {
final String key = "1x1:" + color;
if (all.containsKey( key )) {
@@ -63,7 +63,7 @@ public class TextureCache {
}
}
public static SmartTexture createGradient( int... colors ) {
public synchronized static SmartTexture createGradient( int... colors ) {
final String key = "" + colors;
@@ -88,11 +88,11 @@ public class TextureCache {
}
public static void add( Object key, SmartTexture tx ) {
public synchronized static void add( Object key, SmartTexture tx ) {
all.put( key, tx );
}
public static void remove( Object key ){
public synchronized static void remove( Object key ){
SmartTexture tx = all.get( key );
if (tx != null){
all.remove(key);
@@ -100,7 +100,7 @@ public class TextureCache {
}
}
public static SmartTexture get( Object src ) {
public synchronized static SmartTexture get( Object src ) {
if (all.containsKey( src )) {
@@ -119,17 +119,17 @@ public class TextureCache {
}
public static void clear() {
public synchronized static void clear() {
for (Texture txt:all.values()) {
for (Texture txt : all.values()) {
txt.delete();
}
all.clear();
}
public static void reload() {
for (SmartTexture tx:all.values()) {
public synchronized static void reload() {
for (SmartTexture tx : all.values()) {
tx.reload();
}
}
@@ -164,7 +164,7 @@ public class TextureCache {
}
}
public static boolean contains( Object key ) {
public synchronized static boolean contains( Object key ) {
return all.containsKey( key );
}

View File

@@ -51,8 +51,10 @@ public class Group extends Gizmo {
}
}
members.clear();
members = null;
if (members != null) {
members.clear();
members = null;
}
length = 0;
}