diff options
author | Robin Gareus <robin@gareus.org> | 2019-12-07 11:39:09 +0100 |
---|---|---|
committer | Robin Gareus <robin@gareus.org> | 2019-12-07 15:38:48 +0100 |
commit | 9040fd46709ed27ff89562e5f8517fca8e097600 (patch) | |
tree | 63f478ab4af263b5891aa053dd07c6d94d5ce660 /libs/ardour/source_factory.cc | |
parent | 78337c9a7eb9430ad16004ea448cce98b7396938 (diff) |
Flatten nested try/catch clauses
This also consistently throws a failed_constructor() when instantiating
a CoreAudioSource fails, regardless of the actual exception
Diffstat (limited to 'libs/ardour/source_factory.cc')
-rw-r--r-- | libs/ardour/source_factory.cc | 20 |
1 files changed, 8 insertions, 12 deletions
diff --git a/libs/ardour/source_factory.cc b/libs/ardour/source_factory.cc index cd3c9ef1e8..c783544eb1 100644 --- a/libs/ardour/source_factory.cc +++ b/libs/ardour/source_factory.cc @@ -42,7 +42,7 @@ #include "ardour/smf_source.h" #include "ardour/session.h" -#ifdef HAVE_COREAUDIO +#ifdef HAVE_COREAUDIO #include "ardour/coreaudiosource.h" #endif @@ -183,7 +183,6 @@ SourceFactory::create (Session& s, const XMLNode& node, bool defer_peaks) } else { - try { Source* src = new SndFileSource (s, node); #ifdef BOOST_SP_ENABLE_DEBUG_HOOKS @@ -196,15 +195,11 @@ SourceFactory::create (Session& s, const XMLNode& node, bool defer_peaks) ret->check_for_analysis_data_on_disk (); SourceCreated (ret); return ret; - } - - catch (failed_constructor& err) { + } catch (failed_constructor& err) { } #ifdef HAVE_COREAUDIO - - /* this is allowed to throw */ - - Source *src = new CoreAudioSource (s, node); + try { + Source* src = new CoreAudioSource (s, node); #ifdef BOOST_SP_ENABLE_DEBUG_HOOKS // boost_debug_shared_ptr_mark_interesting (src, "Source"); #endif @@ -217,11 +212,12 @@ SourceFactory::create (Session& s, const XMLNode& node, bool defer_peaks) ret->check_for_analysis_data_on_disk (); SourceCreated (ret); return ret; -#else - throw; // rethrow + } catch (...) { } #endif - } + /* this is allowed to throw */ + throw failed_constructor (); } + } else if (type == DataType::MIDI) { try { boost::shared_ptr<SMFSource> src (new SMFSource (s, node)); |