From f89845e64ad2fd77bc700aa3a2ae1460665aad05 Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Sat, 8 Oct 2022 17:10:47 +0200 Subject: [PATCH] Prevent duplicate signal emission Re-assigning a sigc::connection does not disconnect any previously connected signals. WindowProxy::setup may be called multiple times. Notably plugin windows can change the managed _window (generic/custom), which requires a call to setup. --- libs/gtkmm2ext/window_proxy.cc | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/libs/gtkmm2ext/window_proxy.cc b/libs/gtkmm2ext/window_proxy.cc index 817f920cb9..ac7c3d6c9d 100644 --- a/libs/gtkmm2ext/window_proxy.cc +++ b/libs/gtkmm2ext/window_proxy.cc @@ -229,6 +229,11 @@ WindowProxy::setup () assert (_window); + delete_connection.disconnect (); + configure_connection.disconnect (); + map_connection.disconnect (); + unmap_connection.disconnect (); + delete_connection = _window->signal_delete_event().connect (sigc::mem_fun (*this, &WindowProxy::delete_event_handler)); configure_connection = _window->signal_configure_event().connect (sigc::mem_fun (*this, &WindowProxy::configure_handler), false); map_connection = _window->signal_map().connect (sigc::mem_fun (*this, &WindowProxy::map_handler), false);