moved invalidation into sycnhronized block

This commit is contained in:
Brian Matzon 2007-05-19 20:40:04 +00:00
parent 325ad04c7e
commit 4ec5e9994f
2 changed files with 7 additions and 5 deletions

View File

@ -221,8 +221,8 @@ public final class ALC10 {
*/ */
public static boolean alcCloseDevice(ALCdevice device) { public static boolean alcCloseDevice(ALCdevice device) {
boolean result = nalcCloseDevice(getDevice(device)); boolean result = nalcCloseDevice(getDevice(device));
device.setInvalid();
synchronized (devices) { synchronized (devices) {
device.setInvalid();
devices.remove(new Long(device.device)); devices.remove(new Long(device.device));
} }
return result; return result;
@ -253,8 +253,8 @@ public final class ALC10 {
ALCcontext context = new ALCcontext(context_address); ALCcontext context = new ALCcontext(context_address);
synchronized (ALC10.contexts) { synchronized (ALC10.contexts) {
contexts.put(new Long(context_address), context); contexts.put(new Long(context_address), context);
device.addContext(context);
} }
device.addContext(context);
return context; return context;
} }
return null; return null;
@ -356,8 +356,10 @@ public final class ALC10 {
* @param context address of context to Destroy * @param context address of context to Destroy
*/ */
public static void alcDestroyContext(ALCcontext context) { public static void alcDestroyContext(ALCcontext context) {
nalcDestroyContext(getContext(context)); synchronized(ALC10.contexts) {
context.setInvalid(); nalcDestroyContext(getContext(context));
context.setInvalid();
}
} }
native static void nalcDestroyContext(long context); native static void nalcDestroyContext(long context);

View File

@ -109,8 +109,8 @@ public final class ALC11 {
*/ */
public static boolean alcCaptureCloseDevice(ALCdevice device) { public static boolean alcCaptureCloseDevice(ALCdevice device) {
boolean result = nalcCaptureCloseDevice(ALC10.getDevice(device)); boolean result = nalcCaptureCloseDevice(ALC10.getDevice(device));
device.setInvalid();
synchronized (ALC10.devices) { synchronized (ALC10.devices) {
device.setInvalid();
ALC10.devices.remove(new Long(device.device)); ALC10.devices.remove(new Long(device.device));
} }
return result; return result;