Index: Riskeer/ClosingStructures/src/Riskeer.ClosingStructures.Forms/Views/ClosingStructuresCalculationsView.cs =================================================================== diff -u -r4e8d9d5f3b19a4bcd8c6d217e3d2b180d3171915 -r3a9bdc607d09f3c608af661cb261480eb52abe33 --- Riskeer/ClosingStructures/src/Riskeer.ClosingStructures.Forms/Views/ClosingStructuresCalculationsView.cs (.../ClosingStructuresCalculationsView.cs) (revision 4e8d9d5f3b19a4bcd8c6d217e3d2b180d3171915) +++ Riskeer/ClosingStructures/src/Riskeer.ClosingStructures.Forms/Views/ClosingStructuresCalculationsView.cs (.../ClosingStructuresCalculationsView.cs) (revision 3a9bdc607d09f3c608af661cb261480eb52abe33) @@ -71,7 +71,7 @@ protected override void Dispose(bool disposing) { - if (disposing) + if (disposing && Loaded) { foreshoreProfilesObserver.Dispose(); closingStructuresObserver.Dispose(); Index: Riskeer/Common/src/Riskeer.Common.Forms/Views/CalculationsView.cs =================================================================== diff -u -r0dc048ac66c4b30debb032968fef2c485fe19397 -r3a9bdc607d09f3c608af661cb261480eb52abe33 --- Riskeer/Common/src/Riskeer.Common.Forms/Views/CalculationsView.cs (.../CalculationsView.cs) (revision 0dc048ac66c4b30debb032968fef2c485fe19397) +++ Riskeer/Common/src/Riskeer.Common.Forms/Views/CalculationsView.cs (.../CalculationsView.cs) (revision 3a9bdc607d09f3c608af661cb261480eb52abe33) @@ -88,8 +88,6 @@ FailureMechanism = failureMechanism; AssessmentSection = assessmentSection; - InitializeObservers(); - InitializeComponent(); InitializeListBox(); @@ -123,27 +121,41 @@ /// protected IAssessmentSection AssessmentSection { get; } + /// + /// Gets an indicator whether the view is loaded. + /// + protected bool Loaded { get; private set; } + protected override void OnLoad(EventArgs e) { + InitializeObservers(); + // Necessary to correctly load the content of the dropdown lists of the comboboxes... UpdateDataGridViewDataSource(); base.OnLoad(e); UpdateGenerateCalculationsButtonState(); + + Loaded = true; } protected override void Dispose(bool disposing) { if (disposing) { - failureMechanismObserver.Dispose(); - inputObserver.Dispose(); - calculationObserver.Dispose(); - calculationGroupObserver.Dispose(); - hydraulicBoundaryLocationsObserver.Dispose(); + if (Loaded) + { + failureMechanismObserver.Dispose(); + inputObserver.Dispose(); + calculationObserver.Dispose(); + calculationGroupObserver.Dispose(); + hydraulicBoundaryLocationsObserver.Dispose(); + } components?.Dispose(); + + Loaded = false; } base.Dispose(disposing); Index: Riskeer/GrassCoverErosionInwards/src/Riskeer.GrassCoverErosionInwards.Forms/Views/GrassCoverErosionInwardsCalculationsView.cs =================================================================== diff -u -r4e8d9d5f3b19a4bcd8c6d217e3d2b180d3171915 -r3a9bdc607d09f3c608af661cb261480eb52abe33 --- Riskeer/GrassCoverErosionInwards/src/Riskeer.GrassCoverErosionInwards.Forms/Views/GrassCoverErosionInwardsCalculationsView.cs (.../GrassCoverErosionInwardsCalculationsView.cs) (revision 4e8d9d5f3b19a4bcd8c6d217e3d2b180d3171915) +++ Riskeer/GrassCoverErosionInwards/src/Riskeer.GrassCoverErosionInwards.Forms/Views/GrassCoverErosionInwardsCalculationsView.cs (.../GrassCoverErosionInwardsCalculationsView.cs) (revision 3a9bdc607d09f3c608af661cb261480eb52abe33) @@ -72,7 +72,7 @@ protected override void Dispose(bool disposing) { - if (disposing) + if (disposing && Loaded) { dikeProfilesObserver.Dispose(); } Index: Riskeer/HeightStructures/src/Riskeer.HeightStructures.Forms/Views/HeightStructuresCalculationsView.cs =================================================================== diff -u -r4e8d9d5f3b19a4bcd8c6d217e3d2b180d3171915 -r3a9bdc607d09f3c608af661cb261480eb52abe33 --- Riskeer/HeightStructures/src/Riskeer.HeightStructures.Forms/Views/HeightStructuresCalculationsView.cs (.../HeightStructuresCalculationsView.cs) (revision 4e8d9d5f3b19a4bcd8c6d217e3d2b180d3171915) +++ Riskeer/HeightStructures/src/Riskeer.HeightStructures.Forms/Views/HeightStructuresCalculationsView.cs (.../HeightStructuresCalculationsView.cs) (revision 3a9bdc607d09f3c608af661cb261480eb52abe33) @@ -71,7 +71,7 @@ protected override void Dispose(bool disposing) { - if (disposing) + if (disposing && Loaded) { foreshoreProfilesObserver.Dispose(); heightStructuresObserver.Dispose(); Index: Riskeer/MacroStabilityInwards/src/Riskeer.MacroStabilityInwards.Forms/Views/MacroStabilityInwardsCalculationsView.cs =================================================================== diff -u -r2ce9847b42ca47fc9008c8c18f9158a4b83e0fb3 -r3a9bdc607d09f3c608af661cb261480eb52abe33 --- Riskeer/MacroStabilityInwards/src/Riskeer.MacroStabilityInwards.Forms/Views/MacroStabilityInwardsCalculationsView.cs (.../MacroStabilityInwardsCalculationsView.cs) (revision 2ce9847b42ca47fc9008c8c18f9158a4b83e0fb3) +++ Riskeer/MacroStabilityInwards/src/Riskeer.MacroStabilityInwards.Forms/Views/MacroStabilityInwardsCalculationsView.cs (.../MacroStabilityInwardsCalculationsView.cs) (revision 3a9bdc607d09f3c608af661cb261480eb52abe33) @@ -69,7 +69,7 @@ protected override void Dispose(bool disposing) { - if (disposing) + if (disposing && Loaded) { surfaceLineObserver.Dispose(); stochasticSoilProfileObserver.Dispose(); Index: Riskeer/Piping/src/Riskeer.Piping.Forms/Views/PipingCalculationsView.cs =================================================================== diff -u -r4e8d9d5f3b19a4bcd8c6d217e3d2b180d3171915 -r3a9bdc607d09f3c608af661cb261480eb52abe33 --- Riskeer/Piping/src/Riskeer.Piping.Forms/Views/PipingCalculationsView.cs (.../PipingCalculationsView.cs) (revision 4e8d9d5f3b19a4bcd8c6d217e3d2b180d3171915) +++ Riskeer/Piping/src/Riskeer.Piping.Forms/Views/PipingCalculationsView.cs (.../PipingCalculationsView.cs) (revision 3a9bdc607d09f3c608af661cb261480eb52abe33) @@ -73,7 +73,7 @@ protected override void Dispose(bool disposing) { - if (disposing) + if (disposing && Loaded) { surfaceLineObserver.Dispose(); stochasticSoilProfileObserver.Dispose(); Index: Riskeer/StabilityPointStructures/src/Riskeer.StabilityPointStructures.Forms/Views/StabilityPointStructuresCalculationsView.cs =================================================================== diff -u -r4e8d9d5f3b19a4bcd8c6d217e3d2b180d3171915 -r3a9bdc607d09f3c608af661cb261480eb52abe33 --- Riskeer/StabilityPointStructures/src/Riskeer.StabilityPointStructures.Forms/Views/StabilityPointStructuresCalculationsView.cs (.../StabilityPointStructuresCalculationsView.cs) (revision 4e8d9d5f3b19a4bcd8c6d217e3d2b180d3171915) +++ Riskeer/StabilityPointStructures/src/Riskeer.StabilityPointStructures.Forms/Views/StabilityPointStructuresCalculationsView.cs (.../StabilityPointStructuresCalculationsView.cs) (revision 3a9bdc607d09f3c608af661cb261480eb52abe33) @@ -71,7 +71,7 @@ protected override void Dispose(bool disposing) { - if (disposing) + if (disposing && Loaded) { foreshoreProfilesObserver.Dispose(); stabilityPointStructuresObserver.Dispose();