mirror of
https://github.com/overcuriousity/autopsy-flatpak.git
synced 2025-07-19 11:07:43 +00:00
improve thread safety
This commit is contained in:
parent
48997a097a
commit
9ef9cb28aa
@ -17,6 +17,6 @@ public @interface ThreadConfined {
|
|||||||
|
|
||||||
public enum ThreadType {
|
public enum ThreadType {
|
||||||
|
|
||||||
ANY, UI, NOT_UI
|
ANY, UI, JFX, AWT, NOT_UI
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -44,6 +44,8 @@ import org.sleuthkit.autopsy.coreutils.Logger;
|
|||||||
import org.sleuthkit.autopsy.imageanalyzer.EurekaController;
|
import org.sleuthkit.autopsy.imageanalyzer.EurekaController;
|
||||||
import org.sleuthkit.autopsy.imageanalyzer.EurekaModule;
|
import org.sleuthkit.autopsy.imageanalyzer.EurekaModule;
|
||||||
import org.sleuthkit.autopsy.imageanalyzer.LoggedTask;
|
import org.sleuthkit.autopsy.imageanalyzer.LoggedTask;
|
||||||
|
import org.sleuthkit.autopsy.imageanalyzer.ThreadConfined;
|
||||||
|
import org.sleuthkit.autopsy.imageanalyzer.ThreadConfined.ThreadType;
|
||||||
import org.sleuthkit.autopsy.imageanalyzer.datamodel.Category;
|
import org.sleuthkit.autopsy.imageanalyzer.datamodel.Category;
|
||||||
import org.sleuthkit.autopsy.imageanalyzer.datamodel.DrawableAttribute;
|
import org.sleuthkit.autopsy.imageanalyzer.datamodel.DrawableAttribute;
|
||||||
import org.sleuthkit.autopsy.imageanalyzer.datamodel.DrawableDB;
|
import org.sleuthkit.autopsy.imageanalyzer.datamodel.DrawableDB;
|
||||||
@ -74,12 +76,15 @@ public class GroupManager {
|
|||||||
private final Map<GroupKey, Grouping> groupMap = new HashMap<>();
|
private final Map<GroupKey, Grouping> groupMap = new HashMap<>();
|
||||||
|
|
||||||
/** list of all analyzed groups */
|
/** list of all analyzed groups */
|
||||||
|
@ThreadConfined(type = ThreadType.JFX)
|
||||||
private final ObservableList<Grouping> analyzedGroups = FXCollections.observableArrayList();
|
private final ObservableList<Grouping> analyzedGroups = FXCollections.observableArrayList();
|
||||||
|
|
||||||
/** list of unseen groups */
|
/** list of unseen groups */
|
||||||
|
@ThreadConfined(type = ThreadType.JFX)
|
||||||
private final ObservableList<Grouping> unSeenGroups = FXCollections.observableArrayList();
|
private final ObservableList<Grouping> unSeenGroups = FXCollections.observableArrayList();
|
||||||
|
|
||||||
/** sorted list of unseen groups */
|
/** sorted list of unseen groups */
|
||||||
|
@ThreadConfined(type = ThreadType.JFX)
|
||||||
private final SortedList<Grouping> sortedUnSeenGroups = unSeenGroups.sorted();
|
private final SortedList<Grouping> sortedUnSeenGroups = unSeenGroups.sorted();
|
||||||
|
|
||||||
private ReGroupTask groupByTask;
|
private ReGroupTask groupByTask;
|
||||||
@ -100,6 +105,7 @@ public class GroupManager {
|
|||||||
return analyzedGroups;
|
return analyzedGroups;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ThreadConfined(type = ThreadType.JFX)
|
||||||
public SortedList<Grouping> getUnSeenGroups() {
|
public SortedList<Grouping> getUnSeenGroups() {
|
||||||
return sortedUnSeenGroups;
|
return sortedUnSeenGroups;
|
||||||
}
|
}
|
||||||
@ -542,14 +548,19 @@ public class GroupManager {
|
|||||||
if (groupByTask != null) {
|
if (groupByTask != null) {
|
||||||
groupByTask.cancel(true);
|
groupByTask.cancel(true);
|
||||||
}
|
}
|
||||||
sortedUnSeenGroups.setComparator(sortBy.getGrpComparator(groupBy, sortOrder));
|
Platform.runLater(() -> {
|
||||||
|
sortedUnSeenGroups.setComparator(sortBy.getGrpComparator(groupBy, sortOrder));
|
||||||
|
});
|
||||||
|
|
||||||
groupByTask = new ReGroupTask(groupBy, sortBy, sortOrder);
|
groupByTask = new ReGroupTask(groupBy, sortBy, sortOrder);
|
||||||
controller.submitBGTask(groupByTask);
|
controller.submitBGTask(groupByTask);
|
||||||
} else {
|
} else {
|
||||||
// just resort the list of groups
|
// just resort the list of groups
|
||||||
setSortBy(sortBy);
|
setSortBy(sortBy);
|
||||||
setSortOrder(sortOrder);
|
setSortOrder(sortOrder);
|
||||||
sortedUnSeenGroups.setComparator(sortBy.getGrpComparator(groupBy, sortOrder));
|
Platform.runLater(() -> {
|
||||||
|
sortedUnSeenGroups.setComparator(sortBy.getGrpComparator(groupBy, sortOrder));
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user