aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/Document.cxx
diff options
context:
space:
mode:
authorNeil <nyamatongwe@gmail.com>2021-05-28 14:46:21 +1000
committerNeil <nyamatongwe@gmail.com>2021-05-28 14:46:21 +1000
commitc9b2423aaed459c68dd8f43b1de0edee4eb287c8 (patch)
treef9bfdfa908e5a0a242fb2a00f1ed988682f568c5 /src/Document.cxx
parenta20684909b6edadae8e0c8c9ebc0d15d7fc128ba (diff)
downloadscintilla-mirror-c9b2423aaed459c68dd8f43b1de0edee4eb287c8.tar.gz
Better exception handling for noexcept methods. More accurate noexcept marking.
Diffstat (limited to 'src/Document.cxx')
-rw-r--r--src/Document.cxx18
1 files changed, 12 insertions, 6 deletions
diff --git a/src/Document.cxx b/src/Document.cxx
index 70a711028..c20f7beea 100644
--- a/src/Document.cxx
+++ b/src/Document.cxx
@@ -2477,12 +2477,18 @@ bool Document::AddWatcher(DocWatcher *watcher, void *userData) {
return true;
}
-bool Document::RemoveWatcher(DocWatcher *watcher, void *userData) {
- std::vector<WatcherWithUserData>::iterator it =
- std::find(watchers.begin(), watchers.end(), WatcherWithUserData(watcher, userData));
- if (it != watchers.end()) {
- watchers.erase(it);
- return true;
+bool Document::RemoveWatcher(DocWatcher *watcher, void *userData) noexcept {
+ try {
+ // This can never fail as WatcherWithUserData constructor and == are noexcept
+ // but std::find is not noexcept.
+ std::vector<WatcherWithUserData>::iterator it =
+ std::find(watchers.begin(), watchers.end(), WatcherWithUserData(watcher, userData));
+ if (it != watchers.end()) {
+ watchers.erase(it);
+ return true;
+ }
+ } catch (...) {
+ // Ignore any exception
}
return false;
}