- Use read mutex when checking SceneExplorerProperty value, not just write mutex when writing

git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@10115 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
3.0
nor..67 12 years ago
parent 03f1060500
commit 8fef000fe9
  1. 58
      sdk/jme3-core/src/com/jme3/gde/core/properties/SceneExplorerProperty.java

@ -121,34 +121,38 @@ public class SceneExplorerProperty<T> extends PropertySupport.Reflection<T> {
return; return;
} }
final T realValue = getSuperValue(); final T realValue = getSuperValue();
if ((objectLocal == null) && !inited) { mutex.readAccess(new Runnable() {
mutex.postWriteRequest(new Runnable() { public void run() {
public void run() { if ((objectLocal == null) && !inited) {
inited = true; mutex.postWriteRequest(new Runnable() {
objectLocal = duplicateObject(realValue); public void run() {
notifyListeners(PROP_INIT_CHANGE, null, objectLocal); inited = true;
logger.log(Level.FINE, "Got first sync duplicate for {0}", objectLocal); objectLocal = duplicateObject(realValue);
} notifyListeners(PROP_INIT_CHANGE, null, objectLocal);
}); logger.log(Level.FINE, "Got first sync duplicate for {0}", objectLocal);
} else if ((objectLocal != null) && !objectLocal.equals(realValue)) { }
mutex.postWriteRequest(new Runnable() { });
public void run() { } else if ((objectLocal != null) && !objectLocal.equals(realValue)) {
T oldObject = objectLocal; mutex.postWriteRequest(new Runnable() {
T newObject = duplicateObject(realValue); public void run() {
objectLocal = newObject; T oldObject = objectLocal;
notifyListeners(PROP_SCENE_CHANGE, oldObject, objectLocal); T newObject = duplicateObject(realValue);
logger.log(Level.FINE, "Got update for {0} due to equals check", objectLocal); objectLocal = newObject;
} notifyListeners(PROP_SCENE_CHANGE, oldObject, objectLocal);
}); logger.log(Level.FINE, "Got update for {0} due to equals check", objectLocal);
} else if ((objectLocal == null) && (realValue != null)) { }
mutex.postWriteRequest(new Runnable() { });
public void run() { } else if ((objectLocal == null) && (realValue != null)) {
objectLocal = duplicateObject(realValue); mutex.postWriteRequest(new Runnable() {
notifyListeners(PROP_SCENE_CHANGE, null, objectLocal); public void run() {
logger.log(Level.FINE, "Got update for {0} due to change from null", objectLocal); objectLocal = duplicateObject(realValue);
notifyListeners(PROP_SCENE_CHANGE, null, objectLocal);
logger.log(Level.FINE, "Got update for {0} due to change from null", objectLocal);
}
});
} }
}); }
} });
} }
@Override @Override

Loading…
Cancel
Save