summaryrefslogtreecommitdiff
path: root/libs/ardour/source_factory.cc
diff options
context:
space:
mode:
authorRobin Gareus <robin@gareus.org>2019-12-06 18:06:13 +0100
committerRobin Gareus <robin@gareus.org>2019-12-06 18:16:10 +0100
commit227de8c1b04b68c9e50b6de5adaac435f257f33c (patch)
treeaad71ddd69728650e5f99889bea554b726b630a5 /libs/ardour/source_factory.cc
parent6d99e1b1622dfc4e568dc6efc566a1192a3c123a (diff)
Flatten nested try/catch clauses
This also consistently throws a failed_constructor() when instantiating SoundFile fails, regardless of the actual exception
Diffstat (limited to 'libs/ardour/source_factory.cc')
-rw-r--r--libs/ardour/source_factory.cc15
1 files changed, 5 insertions, 10 deletions
diff --git a/libs/ardour/source_factory.cc b/libs/ardour/source_factory.cc
index 622c535263..3375ff9f0d 100644
--- a/libs/ardour/source_factory.cc
+++ b/libs/ardour/source_factory.cc
@@ -248,27 +248,23 @@ SourceFactory::createExternal (DataType type, Session& s, const string& path,
if (!(flags & Destructive)) {
try {
-
Source* src = new SndFileSource (s, path, chn, flags);
#ifdef BOOST_SP_ENABLE_DEBUG_HOOKS
// boost_debug_shared_ptr_mark_interesting (src, "Source");
#endif
boost::shared_ptr<Source> ret (src);
-
if (setup_peakfile (ret, defer_peaks)) {
return boost::shared_ptr<Source>();
}
-
ret->check_for_analysis_data_on_disk ();
if (announce) {
SourceCreated (ret);
}
return ret;
- }
+ } catch (failed_constructor& err) { }
- catch (failed_constructor& err) {
#ifdef HAVE_COREAUDIO
-
+ try {
Source* src = new CoreAudioSource (s, path, chn, flags);
#ifdef BOOST_SP_ENABLE_DEBUG_HOOKS
// boost_debug_shared_ptr_mark_interesting (src, "Source");
@@ -282,16 +278,15 @@ SourceFactory::createExternal (DataType type, Session& s, const string& path,
SourceCreated (ret);
}
return ret;
-
-#else
- throw; // rethrow
+ } catch (...) { }
#endif
- }
} else {
// eh?
}
+ throw failed_constructor ();
+
} else if (type == DataType::MIDI) {
try {