[gtkmm] Gtk::Window: Make the move ctor noexcept



commit 3d6445d6de6f89f07276b68257bdc355dc87f0cd
Author: Kjell Ahlstedt <kjellahlstedt gmail com>
Date:   Thu Nov 28 13:15:42 2019 +0100

    Gtk::Window: Make the move ctor noexcept

 gtk/src/window.ccg | 13 +++++++++++--
 gtk/src/window.hg  |  4 ++--
 2 files changed, 13 insertions(+), 4 deletions(-)
---
diff --git a/gtk/src/window.ccg b/gtk/src/window.ccg
index 926edc76..a7b089de 100644
--- a/gtk/src/window.ccg
+++ b/gtk/src/window.ccg
@@ -43,12 +43,21 @@ Window::Window(GtkWindow* castitem)
   signal_hide().connect(sigc::mem_fun(*this, &Window::on_window_hide));
 }
 
-Window::Window(Window&& src)
+Window::Window(Window&& src) noexcept
 : Gtk::Bin(std::move(src))
   , Native(std::move(src))
   , Root(std::move(src))
 {
-  signal_hide().connect(sigc::mem_fun(*this, &Window::on_window_hide));
+  try
+  {
+    signal_hide().connect(sigc::mem_fun(*this, &Window::on_window_hide));
+  }
+  catch (...)
+  {
+    // Ignore exceptions.
+    // The move ctor shall be noexcept. It can be called from a move ctor
+    // in a subclass, such as Gtk::Dialog.
+  }
 }
 
 // The move assignment is identical to the one that gmmproc can generate.
diff --git a/gtk/src/window.hg b/gtk/src/window.hg
index 85fb66e0..6d9826f3 100644
--- a/gtk/src/window.hg
+++ b/gtk/src/window.hg
@@ -73,10 +73,10 @@ public:
   // All constructors are hand-coded, because they connect a signal handler.
   _CUSTOM_CTOR_CAST()
   _CUSTOM_MOVE_OPERATIONS()
-  Window(Window&& src);
+  Window(Window&& src) noexcept;
   Window& operator=(Window&& src) noexcept;
 
-  explicit Window(WindowType type =  WindowType::TOPLEVEL);
+  explicit Window(WindowType type = WindowType::TOPLEVEL);
   _IGNORE(gtk_window_new)
 
   _WRAP_PROPERTY("type", WindowType)


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]