Fix progress
authorNiki Roo <niki@nikiroo.be>
Thu, 23 Nov 2017 18:10:12 +0000 (19:10 +0100)
committerNiki Roo <niki@nikiroo.be>
Thu, 23 Nov 2017 18:10:12 +0000 (19:10 +0100)
src/be/nikiroo/utils/Progress.java

index d722fc91c3289e9f0b0425cba4bfba87fdc1b88f..ae5960379f12bcd2cecc17d3f7a81134f38ca018 100644 (file)
@@ -293,14 +293,18 @@ public class Progress {
         * @return TRUE if it is
         */
        public boolean isDone() {
-               return relativeProgress >= 1d;
+               return getProgress() == max;
        }
 
        /**
         * Mark the {@link Progress} as done by setting its value to max.
         */
        public void done() {
-               setProgress(getMax());
+               synchronized (getLock()) {
+                       double childrenProgress = relativeProgress - relativeLocalProgress;
+                       relativeLocalProgress = 1 - childrenProgress;
+                       setRelativeProgress(this, name, 1d);
+               }
        }
 
        /**