mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
project structure: don't recreate modifiable models during applying changes (IDEA-168208)
Previously if someone tries to access ModuleRootModel after ModuleEditor.apply is called but before the model returned by it is committed (e.g. from myFacetsConfigurator.applyEditors) a new ModifiableRootModel instance will be created from the original ModuleRootModel, thus it won't include changes made in Project Structure dialog and may contain invalid OrderEntry instances.
This commit is contained in:
@@ -318,24 +318,21 @@ public abstract class ModuleEditor implements Place.Navigator, Disposable {
|
||||
myGenericSettingsPanel = null;
|
||||
}
|
||||
finally {
|
||||
myModifiableRootModel = null;
|
||||
myModifiableRootModelProxy = null;
|
||||
resetModifiableModel();
|
||||
}
|
||||
}
|
||||
|
||||
public ModifiableRootModel apply() throws ConfigurationException {
|
||||
try {
|
||||
for (ModuleConfigurationEditor editor : myEditors) {
|
||||
editor.saveData();
|
||||
editor.apply();
|
||||
}
|
||||
for (ModuleConfigurationEditor editor : myEditors) {
|
||||
editor.saveData();
|
||||
editor.apply();
|
||||
}
|
||||
return myModifiableRootModel;
|
||||
}
|
||||
|
||||
return myModifiableRootModel;
|
||||
}
|
||||
finally {
|
||||
myModifiableRootModel = null;
|
||||
myModifiableRootModelProxy = null;
|
||||
}
|
||||
void resetModifiableModel() {
|
||||
myModifiableRootModel = null;
|
||||
myModifiableRootModelProxy = null;
|
||||
}
|
||||
|
||||
public void canApply() throws ConfigurationException {
|
||||
|
||||
@@ -313,6 +313,9 @@ public class ModulesConfigurator implements ModulesProvider, ModuleEditor.Change
|
||||
|
||||
try {
|
||||
ModifiableModelCommitter.multiCommit(models, myModuleModel);
|
||||
for (ModuleEditor editor : myModuleEditors.values()) {
|
||||
editor.resetModifiableModel();
|
||||
}
|
||||
myModuleModelCommitted = true;
|
||||
myFacetsConfigurator.commitFacets();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user