@@ -31,40 +31,34 @@ index 7764357a6d..da7374ecec 100644
3131 vcpkg_cmake_install(ADD_BIN_TO_PATH)
3232diff --git a/ports/orc/orc-fix-exception-propagation.diff b/ports/orc/orc-fix-exception-propagation.diff
3333new file mode 100644
34- index 0000000000..7d0c87f3db
34+ index 0000000000..25568e70cd
3535--- /dev/null
3636+++ b/ports/orc/orc-fix-exception-propagation.diff
37- @@ -0,0 +1,36 @@
37+ @@ -0,0 +1,30 @@
3838+ diff --git a/c++/src/Timezone.cc b/c++/src/Timezone.cc
39- + index 384f8ea99..0b58d0720 100644
39+ + index 384f8ea99..07c75e0a7 100644
4040+ --- a/c++/src/Timezone.cc
4141+ +++ b/c++/src/Timezone.cc
42- + @@ -695,13 +695,26 @@ namespace orc {
43- + private:
42+ + @@ -696,12 +696,21 @@ namespace orc {
4443+ std::string filename_;
4544+ mutable std::unique_ptr<TimezoneImpl> impl_;
46- + - mutable std::once_flag initialized_;
47- + + mutable std::mutex init_mutex_;
48- + + mutable bool initialized_ = false;
45+ + mutable std::once_flag initialized_;
4946+ + mutable std::exception_ptr init_exception_;
5047+
5148+ TimezoneImpl* getImpl() const {
5249+ - std::call_once(initialized_, [&]() {
5350+ - auto buffer = loadTZDB(filename_);
5451+ - impl_ = std::make_unique<TimezoneImpl>(filename_, std::move(buffer));
5552+ - });
56- + + std::lock_guard<std::mutex> lock(init_mutex_);
57- + + if (!initialized_) {
58- + + try {
59- + + auto buffer = loadTZDB(filename_);
60- + + impl_ = std::make_unique<TimezoneImpl>(filename_, std::move(buffer));
61- + + initialized_ = true;
62- + + } catch (...) {
63- + + init_exception_ = std::current_exception();
64- + + initialized_ = true;
65- + + }
66- + + }
67- + + // If initialization failed, re-throw the exception
53+ + + std::call_once(initialized_, [&]() {
54+ + + try {
55+ + + auto buffer = loadTZDB(filename_);
56+ + + impl_ = std::make_unique<TimezoneImpl>(filename_, std::move(buffer));
57+ + + } catch (...) {
58+ + + // If initialization failed, re-throw the exception
59+ + + init_exception_ = std::current_exception();
60+ + + }
61+ + + });
6862+ + if (init_exception_) {
6963+ + std::rethrow_exception(init_exception_);
7064+ + }
0 commit comments