Bug 575483 - Eclipse may forget to build
hasBuildChanges should be volatile, setBuild() synchronized
Change-Id: I420925f064dd3f4c7ba08d1710a605f5da46c086
Signed-off-by: Andrey Loskutov <loskutov@gmx.de>
Reviewed-on: https://git.eclipse.org/r/c/platform/eclipse.platform.resources/+/184202
Reviewed-by: Jörg Kubitz <jkubitz-eclipse@gmx.de>
diff --git a/bundles/org.eclipse.core.resources/src/org/eclipse/core/internal/resources/WorkManager.java b/bundles/org.eclipse.core.resources/src/org/eclipse/core/internal/resources/WorkManager.java
index b3c29f4..39d00ec 100644
--- a/bundles/org.eclipse.core.resources/src/org/eclipse/core/internal/resources/WorkManager.java
+++ b/bundles/org.eclipse.core.resources/src/org/eclipse/core/internal/resources/WorkManager.java
@@ -67,7 +67,7 @@
/**
* Indicates whether any operations have run that may require a build.
*/
- private boolean hasBuildChanges = false;
+ private volatile boolean hasBuildChanges;
private IJobManager jobManager;
/**
* The primary workspace lock. This lock must be held by any thread
@@ -284,7 +284,7 @@
* Indicates if the operation that has just completed may potentially
* require a build.
*/
- public void setBuild(boolean hasChanges) {
+ public synchronized void setBuild(boolean hasChanges) {
if (hasChanges && Policy.DEBUG_BUILD_NEEDED) {
Policy.debug("Set build hasChanges: " + hasChanges + " hasBuildChanges: " + hasBuildChanges); //$NON-NLS-1$ //$NON-NLS-2$
if (!hasBuildChanges && Policy.DEBUG_BUILD_NEEDED_STACK) {