summaryrefslogtreecommitdiff
path: root/src/smt/smt_engine.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/smt/smt_engine.cpp')
-rw-r--r--src/smt/smt_engine.cpp104
1 files changed, 61 insertions, 43 deletions
diff --git a/src/smt/smt_engine.cpp b/src/smt/smt_engine.cpp
index 63c970920..e5db42a22 100644
--- a/src/smt/smt_engine.cpp
+++ b/src/smt/smt_engine.cpp
@@ -581,49 +581,67 @@ class SmtEnginePrivate : public NodeManagerListener {
d_listenerRegistrations->add(d_resourceManager->registerHardListener(
new HardResourceOutListener(d_smt)));
- Options& nodeManagerOptions = NodeManager::currentNM()->getOptions();
- d_listenerRegistrations->add(
- nodeManagerOptions.registerForceLogicListener(
- new SetLogicListener(d_smt), true));
-
- // Multiple options reuse BeforeSearchListener so registration requires an
- // extra bit of care.
- // We can safely not call notify on this before search listener at
- // registration time. This d_smt cannot be beforeSearch at construction
- // time. Therefore the BeforeSearchListener is a no-op. Therefore it does
- // not have to be called.
- d_listenerRegistrations->add(
- nodeManagerOptions.registerBeforeSearchListener(
- new BeforeSearchListener(d_smt)));
-
- // These do need registration calls.
- d_listenerRegistrations->add(
- nodeManagerOptions.registerSetDefaultExprDepthListener(
- new SetDefaultExprDepthListener(), true));
- d_listenerRegistrations->add(
- nodeManagerOptions.registerSetDefaultExprDagListener(
- new SetDefaultExprDagListener(), true));
- d_listenerRegistrations->add(
- nodeManagerOptions.registerSetPrintExprTypesListener(
- new SetPrintExprTypesListener(), true));
- d_listenerRegistrations->add(
- nodeManagerOptions.registerSetDumpModeListener(
- new DumpModeListener(), true));
- d_listenerRegistrations->add(
- nodeManagerOptions.registerSetPrintSuccessListener(
- new PrintSuccessListener(), true));
- d_listenerRegistrations->add(
- nodeManagerOptions.registerSetRegularOutputChannelListener(
- new SetToDefaultSourceListener(&d_managedRegularChannel), true));
- d_listenerRegistrations->add(
- nodeManagerOptions.registerSetDiagnosticOutputChannelListener(
- new SetToDefaultSourceListener(&d_managedDiagnosticChannel), true));
- d_listenerRegistrations->add(
- nodeManagerOptions.registerDumpToFileNameListener(
- new SetToDefaultSourceListener(&d_managedDumpChannel), true));
- d_listenerRegistrations->add(
- nodeManagerOptions.registerSetReplayLogFilename(
- new SetToDefaultSourceListener(&d_managedReplayLog), true));
+ try
+ {
+ Options& nodeManagerOptions = NodeManager::currentNM()->getOptions();
+ d_listenerRegistrations->add(
+ nodeManagerOptions.registerForceLogicListener(
+ new SetLogicListener(d_smt), true));
+
+ // Multiple options reuse BeforeSearchListener so registration requires an
+ // extra bit of care.
+ // We can safely not call notify on this before search listener at
+ // registration time. This d_smt cannot be beforeSearch at construction
+ // time. Therefore the BeforeSearchListener is a no-op. Therefore it does
+ // not have to be called.
+ d_listenerRegistrations->add(
+ nodeManagerOptions.registerBeforeSearchListener(
+ new BeforeSearchListener(d_smt)));
+
+ // These do need registration calls.
+ d_listenerRegistrations->add(
+ nodeManagerOptions.registerSetDefaultExprDepthListener(
+ new SetDefaultExprDepthListener(), true));
+ d_listenerRegistrations->add(
+ nodeManagerOptions.registerSetDefaultExprDagListener(
+ new SetDefaultExprDagListener(), true));
+ d_listenerRegistrations->add(
+ nodeManagerOptions.registerSetPrintExprTypesListener(
+ new SetPrintExprTypesListener(), true));
+ d_listenerRegistrations->add(
+ nodeManagerOptions.registerSetDumpModeListener(new DumpModeListener(),
+ true));
+ d_listenerRegistrations->add(
+ nodeManagerOptions.registerSetPrintSuccessListener(
+ new PrintSuccessListener(), true));
+ d_listenerRegistrations->add(
+ nodeManagerOptions.registerSetRegularOutputChannelListener(
+ new SetToDefaultSourceListener(&d_managedRegularChannel), true));
+ d_listenerRegistrations->add(
+ nodeManagerOptions.registerSetDiagnosticOutputChannelListener(
+ new SetToDefaultSourceListener(&d_managedDiagnosticChannel),
+ true));
+ d_listenerRegistrations->add(
+ nodeManagerOptions.registerDumpToFileNameListener(
+ new SetToDefaultSourceListener(&d_managedDumpChannel), true));
+ d_listenerRegistrations->add(
+ nodeManagerOptions.registerSetReplayLogFilename(
+ new SetToDefaultSourceListener(&d_managedReplayLog), true));
+ }
+ catch (OptionException& e)
+ {
+ // Registering the option listeners can lead to OptionExceptions, e.g.
+ // when the user chooses a dump tag that does not exist. In that case, we
+ // have to make sure that we delete existing listener registrations and
+ // that we unsubscribe from NodeManager events. Otherwise we will have
+ // errors in the deconstructors of the NodeManager (because the
+ // NodeManager tries to notify an SmtEnginePrivate that does not exist)
+ // and the ListenerCollection (because not all registrations have been
+ // removed before calling the deconstructor).
+ delete d_listenerRegistrations;
+ d_smt.d_nodeManager->unsubscribeEvents(this);
+ throw OptionException(e.getRawMessage());
+ }
}
~SmtEnginePrivate()
generated by cgit on debian on lair
contact matthew@masot.net with questions or feedback