Skip to content

Commit 3f71b3a

Browse files
committed
add destructor for environment variables
1 parent e1d3247 commit 3f71b3a

2 files changed

Lines changed: 18 additions & 2 deletions

File tree

FlashpointSecurePlayer/EnvironmentVariables.cs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,14 @@ public class EnvironmentVariables : Modifications {
2222

2323
public EnvironmentVariables(EventHandler importStart, EventHandler importStop) : base(importStart, importStop) { }
2424

25+
~EnvironmentVariables() {
26+
try {
27+
Deactivate();
28+
} catch {
29+
// fail silently
30+
}
31+
}
32+
2533
private string GetComparableName(string name) {
2634
if (name == null) {
2735
return name;

FlashpointSecurePlayer/Modifications.cs

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,18 @@ public Modifications(EventHandler importStart, EventHandler importStop) {
2121

2222
~Modifications() {
2323
if (ImportStarted) {
24-
StopImport();
24+
try {
25+
StopImport();
26+
} catch {
27+
// fail silently
28+
}
2529
}
2630

27-
Deactivate();
31+
try {
32+
Deactivate();
33+
} catch {
34+
// fail silently
35+
}
2836
}
2937

3038
private void OnImportStart(EventArgs e) {

0 commit comments

Comments
 (0)