aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorZufu Liu <unknown>2024-05-06 14:48:38 +1000
committerZufu Liu <unknown>2024-05-06 14:48:38 +1000
commitd61d88dbd8e5d8a12cd488c9437c5aa9ebcc0471 (patch)
tree6a418bbcb53c627efb685719d843babc67d19a24
parent371f23c5746dfa85c48f654c4bd273135799dab8 (diff)
downloadscintilla-mirror-d61d88dbd8e5d8a12cd488c9437c5aa9ebcc0471.tar.gz
Make LoadD2D noexcept so can be called in more situations.
-rw-r--r--win32/PlatWin.cxx8
-rw-r--r--win32/PlatWin.h2
2 files changed, 7 insertions, 3 deletions
diff --git a/win32/PlatWin.cxx b/win32/PlatWin.cxx
index c3c6b609a..144077b95 100644
--- a/win32/PlatWin.cxx
+++ b/win32/PlatWin.cxx
@@ -124,9 +124,13 @@ void LoadD2DOnce() noexcept {
}
}
-bool LoadD2D() {
+bool LoadD2D() noexcept {
static std::once_flag once;
- std::call_once(once, LoadD2DOnce);
+ try {
+ std::call_once(once, LoadD2DOnce);
+ } catch (...) {
+ // ignore
+ }
return pIDWriteFactory && pD2DFactory;
}
diff --git a/win32/PlatWin.h b/win32/PlatWin.h
index 70721d4a7..a901ec78d 100644
--- a/win32/PlatWin.h
+++ b/win32/PlatWin.h
@@ -68,7 +68,7 @@ public:
};
#if defined(USE_D2D)
-extern bool LoadD2D();
+extern bool LoadD2D() noexcept;
extern ID2D1Factory *pD2DFactory;
extern IDWriteFactory *pIDWriteFactory;