aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorNeil <nyamatongwe@gmail.com>2021-03-17 12:44:47 +1100
committerNeil <nyamatongwe@gmail.com>2021-03-17 12:44:47 +1100
commit907c32f8149ec13c39c90424cfed018b2b1eac87 (patch)
tree7f557df7306cdbf0c2fc623ef271826c473ee007
parentb36983d5f4550bb14afe0e557831b9004dad7409 (diff)
downloadscintilla-mirror-907c32f8149ec13c39c90424cfed018b2b1eac87.tar.gz
Mark Window::Destroy, ListBox::Clear, and Menu::Destroy as noexcept since
destroying state should not throw.
-rw-r--r--cocoa/PlatCocoa.mm8
-rwxr-xr-xgtk/PlatGTK.cxx10
-rw-r--r--qt/ScintillaEditBase/PlatQt.cpp8
-rw-r--r--src/Platform.h6
-rw-r--r--win32/PlatWin.cxx8
5 files changed, 20 insertions, 20 deletions
diff --git a/cocoa/PlatCocoa.mm b/cocoa/PlatCocoa.mm
index 82dd3b030..eb7a93ef1 100644
--- a/cocoa/PlatCocoa.mm
+++ b/cocoa/PlatCocoa.mm
@@ -1673,7 +1673,7 @@ public:
int GetVisibleRows() const override;
PRectangle GetDesiredRect() override;
int CaretFromEdge() override;
- void Clear() override;
+ void Clear() noexcept override;
void Append(char *s, int type = -1) override;
int Length() override;
void Select(int n) override;
@@ -1820,7 +1820,7 @@ void ListBoxImpl::ReleaseViews() {
ds = nil;
}
-void ListBoxImpl::Clear() {
+void ListBoxImpl::Clear() noexcept {
maxItemWidth = 0;
maxIconWidth = 0;
ld.Clear();
@@ -1975,7 +1975,7 @@ ListBox *ListBox::Allocate() {
//--------------------------------------------------------------------------------------------------
-void Window::Destroy() {
+void Window::Destroy() noexcept {
ListBoxImpl *listbox = dynamic_cast<ListBoxImpl *>(this);
if (listbox) {
listbox->ReleaseViews();
@@ -2025,7 +2025,7 @@ void Menu::CreatePopUp() {
//--------------------------------------------------------------------------------------------------
-void Menu::Destroy() {
+void Menu::Destroy() noexcept {
CFBridgingRelease(mid);
mid = nullptr;
}
diff --git a/gtk/PlatGTK.cxx b/gtk/PlatGTK.cxx
index 29946646e..e3820aec4 100755
--- a/gtk/PlatGTK.cxx
+++ b/gtk/PlatGTK.cxx
@@ -978,7 +978,7 @@ Surface *Surface::Allocate(int) {
Window::~Window() {}
-void Window::Destroy() {
+void Window::Destroy() noexcept {
if (wid) {
ListBox *listbox = dynamic_cast<ListBox *>(this);
if (listbox) {
@@ -1248,7 +1248,7 @@ public:
int GetRowHeight();
PRectangle GetDesiredRect() override;
int CaretFromEdge() override;
- void Clear() override;
+ void Clear() noexcept override;
void Append(char *s, int type = -1) override;
int Length() override;
void Select(int n) override;
@@ -1659,13 +1659,13 @@ int ListBoxX::CaretFromEdge() {
return 4 + renderer_width;
}
-void ListBoxX::Clear() {
+void ListBoxX::Clear() noexcept {
GtkTreeModel *model = gtk_tree_view_get_model(GTK_TREE_VIEW(list));
gtk_list_store_clear(GTK_LIST_STORE(model));
maxItemCharacters = 0;
}
-static void init_pixmap(ListImage *list_image) {
+static void init_pixmap(ListImage *list_image) noexcept {
if (list_image->rgba_data) {
// Drop any existing pixmap/bitmap as data may have changed
if (list_image->pixbuf)
@@ -1916,7 +1916,7 @@ void Menu::CreatePopUp() {
g_object_ref_sink(G_OBJECT(mid));
}
-void Menu::Destroy() {
+void Menu::Destroy() noexcept {
if (mid)
g_object_unref(G_OBJECT(mid));
mid = nullptr;
diff --git a/qt/ScintillaEditBase/PlatQt.cpp b/qt/ScintillaEditBase/PlatQt.cpp
index d41dbfbf3..4bdd04778 100644
--- a/qt/ScintillaEditBase/PlatQt.cpp
+++ b/qt/ScintillaEditBase/PlatQt.cpp
@@ -658,7 +658,7 @@ QRect ScreenRectangleForPoint(QPoint posGlobal)
Window::~Window() {}
-void Window::Destroy()
+void Window::Destroy() noexcept
{
if (wid)
delete window(wid);
@@ -801,7 +801,7 @@ public:
int GetVisibleRows() const override;
PRectangle GetDesiredRect() override;
int CaretFromEdge() override;
- void Clear() override;
+ void Clear() noexcept override;
void Append(char *s, int type = -1) override;
int Length() override;
void Select(int n) override;
@@ -928,7 +928,7 @@ int ListBoxImpl::CaretFromEdge()
#endif
return maxIconWidth + (2 * list->frameWidth()) + extra;
}
-void ListBoxImpl::Clear()
+void ListBoxImpl::Clear() noexcept
{
ListWidget *list = GetWidget();
list->clear();
@@ -1117,7 +1117,7 @@ void Menu::CreatePopUp()
mid = new QMenu();
}
-void Menu::Destroy()
+void Menu::Destroy() noexcept
{
if (mid) {
QMenu *menu = static_cast<QMenu *>(mid);
diff --git a/src/Platform.h b/src/Platform.h
index 64c5610c4..0ea086393 100644
--- a/src/Platform.h
+++ b/src/Platform.h
@@ -247,7 +247,7 @@ public:
virtual ~Window();
WindowID GetID() const noexcept { return wid; }
bool Created() const noexcept { return wid != nullptr; }
- void Destroy();
+ void Destroy() noexcept;
PRectangle GetPosition() const;
void SetPosition(PRectangle rc);
void SetPositionRelative(PRectangle rc, const Window *relativeTo);
@@ -293,7 +293,7 @@ public:
virtual int GetVisibleRows() const=0;
virtual PRectangle GetDesiredRect()=0;
virtual int CaretFromEdge()=0;
- virtual void Clear()=0;
+ virtual void Clear() noexcept=0;
virtual void Append(char *s, int type = -1)=0;
virtual int Length()=0;
virtual void Select(int n)=0;
@@ -316,7 +316,7 @@ public:
Menu() noexcept;
MenuID GetID() const noexcept { return mid; }
void CreatePopUp();
- void Destroy();
+ void Destroy() noexcept;
void Show(Point pt, Window &w);
};
diff --git a/win32/PlatWin.cxx b/win32/PlatWin.cxx
index 657f53128..b73e7145e 100644
--- a/win32/PlatWin.cxx
+++ b/win32/PlatWin.cxx
@@ -2294,7 +2294,7 @@ Surface *Surface::Allocate(int technology) {
Window::~Window() {
}
-void Window::Destroy() {
+void Window::Destroy() noexcept {
if (wid)
::DestroyWindow(HwndFromWindowID(wid));
wid = nullptr;
@@ -2605,7 +2605,7 @@ public:
int GetVisibleRows() const override;
PRectangle GetDesiredRect() override;
int CaretFromEdge() override;
- void Clear() override;
+ void Clear() noexcept override;
void Append(char *s, int type = -1) override;
int Length() override;
void Select(int n) override;
@@ -2730,7 +2730,7 @@ int ListBoxX::CaretFromEdge() {
return TextOffset() + static_cast<int>(TextInset.x + (0 - rc.left) - 1);
}
-void ListBoxX::Clear() {
+void ListBoxX::Clear() noexcept {
ListBox_ResetContent(lb);
maxItemCharacters = 0;
widestItem = nullptr;
@@ -3398,7 +3398,7 @@ void Menu::CreatePopUp() {
mid = ::CreatePopupMenu();
}
-void Menu::Destroy() {
+void Menu::Destroy() noexcept {
if (mid)
::DestroyMenu(static_cast<HMENU>(mid));
mid = 0;