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.
This commit is contained in:
Robin Gareus 2022-10-08 17:10:47 +02:00
parent 0dc4f4bf45
commit f89845e64a
Signed by: rgareus
GPG Key ID: A090BCE02CF57F04

View File

@ -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);