From 63b5c9ea2bf04e2f0f2e658dbb79c8daa2b6f3a8 Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Wed, 22 May 2024 18:25:22 +0200 Subject: [PATCH] Trying to track down mysterious cxxabiv1::failed_throw It seems that a `Glib::ConvertError` is thrown, and then the function that catches the error causes another ConvertError in `err.what()` (which presumably include the filename that causes the error). relevant part of the backtrace (macOS Crashdump): ``` Glib::ConvertError::throw_func(_GError*) + 56 Glib::Error::throw_exception(_GError*) + 292 Glib::operator<<(std::__1::basic_ostream >&, Glib::ustring const&) + 131 StringPrivate::Composition& StringPrivate::Composition::arg(Glib::ustring const&) + 25 std::__1::basic_string, std::__1::allocator > string_compose (...) + 81 PBD::run_functor_for_paths(...) + 1313 ``` --- libs/pbd/file_utils.cc | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/libs/pbd/file_utils.cc b/libs/pbd/file_utils.cc index befc5235c8..e65f032a84 100644 --- a/libs/pbd/file_utils.cc +++ b/libs/pbd/file_utils.cc @@ -82,14 +82,15 @@ run_functor_for_paths (vector& result, bool recurse) { for (vector::const_iterator i = paths.begin(); i != paths.end(); ++i) { - string expanded_path = path_expand (*i); - DEBUG_TRACE (DEBUG::FileUtils, - string_compose("Find files in expanded path: %1\n", expanded_path)); - - if (!Glib::file_test (expanded_path, Glib::FILE_TEST_IS_DIR)) continue; - try { + string expanded_path = path_expand (*i); + + DEBUG_TRACE (DEBUG::FileUtils, + string_compose("Find files in expanded path: %1\n", expanded_path)); + + if (!Glib::file_test (expanded_path, Glib::FILE_TEST_IS_DIR)) continue; + Glib::Dir dir(expanded_path); for (Glib::DirIterator di = dir.begin(); di != dir.end(); di++) { @@ -137,10 +138,18 @@ run_functor_for_paths (vector& result, } } catch (Glib::FileError const& err) { +#ifndef NDEBUG warning << string_compose (_("Cannot access file: %1"), err.what()) << endmsg; +#endif } catch (Glib::ConvertError const& err) { +#ifndef NDEBUG warning << string_compose (_("Could not convert filename: %1"), err.what()) << endmsg; +#endif + } catch (...) { +#ifndef NDEBUG + warning << string_compose (_("Could not convert filename: '%1'"), *i) << endmsg; +#endif } } }