Skip to content

Commit

Permalink
Update main.d
Browse files Browse the repository at this point in the history
* Fix --version segfault
  • Loading branch information
abraunegg committed Oct 5, 2023
1 parent 51f0ffc commit c44ad96
Showing 1 changed file with 20 additions and 18 deletions.
38 changes: 20 additions & 18 deletions src/main.d
Original file line number Diff line number Diff line change
Expand Up @@ -75,17 +75,18 @@ int main(string[] cliArgs) {
if (itemDB !is null) {
// Make sure the .wal file is incorporated into the main db before we exit
itemDB.performVacuum();
object.destroy(itemDB);
}

// Cleanup any existing dry-run elements ... these should never be left hanging around
cleanupDryRunDatabaseFiles(appConfig.databaseFilePathDryRun);

// Free object and memory
object.destroy(appConfig);
object.destroy(oneDriveApiInstance);
object.destroy(selectiveSync);
object.destroy(syncEngineInstance);
object.destroy(itemDB);
// Free other objects and memory
if (appConfig !is null) {
// Cleanup any existing dry-run elements ... these should never be left hanging around
cleanupDryRunDatabaseFiles(appConfig.databaseFilePathDryRun);
object.destroy(appConfig);
}
if (oneDriveApiInstance !is null) object.destroy(oneDriveApiInstance);
if (selectiveSync !is null) object.destroy(selectiveSync);
if (syncEngineInstance !is null) object.destroy(syncEngineInstance);
}

scope(failure) {
Expand All @@ -96,17 +97,18 @@ int main(string[] cliArgs) {
if (itemDB !is null) {
// Make sure the .wal file is incorporated into the main db before we exit
itemDB.performVacuum();
object.destroy(itemDB);
}

// Cleanup any existing dry-run elements ... these should never be left hanging around
cleanupDryRunDatabaseFiles(appConfig.databaseFilePathDryRun);

// Free object and memory
object.destroy(appConfig);
object.destroy(oneDriveApiInstance);
object.destroy(selectiveSync);
object.destroy(syncEngineInstance);
object.destroy(itemDB);
// Free other objects and memory
if (appConfig !is null) {
// Cleanup any existing dry-run elements ... these should never be left hanging around
cleanupDryRunDatabaseFiles(appConfig.databaseFilePathDryRun);
object.destroy(appConfig);
}
if (oneDriveApiInstance !is null) object.destroy(oneDriveApiInstance);
if (selectiveSync !is null) object.destroy(selectiveSync);
if (syncEngineInstance !is null) object.destroy(syncEngineInstance);
}

// Read in application options as passed in
Expand Down

0 comments on commit c44ad96

Please sign in to comment.