@@ -10,6 +10,17 @@ WfWpControl::WfWpControl(WpPipewireObject *obj, WayfireWpMixer *parent_widget)
1010 parent = parent_widget;
1111}
1212
13+ WfWpControl::~WfWpControl ()
14+ {
15+ mute_conn.disconnect ();
16+ middle_conn.disconnect ();
17+ right_conn.disconnect ();
18+ for (auto signal : signals)
19+ {
20+ signal.disconnect ();
21+ }
22+ }
23+
1324void WfWpControl::init ()
1425{
1526 guint32 id = wp_proxy_get_bound_id (WP_PROXY (object));
@@ -53,7 +64,7 @@ void WfWpControl::init()
5364
5465 // setup user interactions
5566
56- mute_conn = button.signal_toggled ().connect (
67+ signals. push_back ( mute_conn = button.signal_toggled ().connect (
5768 [this , id] ()
5869 {
5970 // if the menu was popped up because of an external change
@@ -63,7 +74,7 @@ void WfWpControl::init()
6374 // disregarding the return value prevents cases where ignore is read at an ncorrect time,
6475 // with the only problem of having one update ignored if something goes very wrong
6576 WpCommon::get ().set_mute (id, button.get_active ());
66- });
77+ })) ;
6778
6879 scale.set_user_changed_callback (
6980 [this , id] ()
@@ -74,7 +85,7 @@ void WfWpControl::init()
7485 });
7586
7687 auto scroll_gesture = Gtk::EventControllerScroll::create ();
77- scroll_gesture->signal_scroll ().connect ([=] (double dx, double dy)
88+ signals. push_back ( scroll_gesture->signal_scroll ().connect ([=] (double dx, double dy)
7889 {
7990 dy = parent->invert_scroll ? dy : dy * -1 ; // for the same scrolling as volume widget, which we will
8091 // agree it is more intuitive for more people
@@ -92,7 +103,7 @@ void WfWpControl::init()
92103
93104 WpCommon::get ().set_volume (id, scale.get_target_value () + change);
94105 return true ;
95- }, true );
106+ }, true )) ;
96107 scroll_gesture->set_flags (Gtk::EventControllerScroll::Flags::VERTICAL);
97108 add_controller (scroll_gesture);
98109
@@ -200,6 +211,11 @@ std::unique_ptr<WfWpControl> WfWpControl::copy()
200211 return std::make_unique<WfWpControl>(object, parent);
201212}
202213
214+ WfWpControlDevice::~WfWpControlDevice ()
215+ {
216+ def_conn.disconnect ();
217+ }
218+
203219void WfWpControlDevice::init ()
204220{
205221 default_btn.get_style_context ()->add_class (" wireplumber" );
0 commit comments