From: Mikko Rasa Date: Wed, 26 Sep 2007 17:20:50 +0000 (+0000) Subject: Bugfixes for SmoothControl pairing X-Git-Tag: 0.9~18 X-Git-Url: http://git.tdb.fi/?a=commitdiff_plain;h=0639a524acf40293d79ebb65b20c27385a82431e;p=libs%2Fgui.git Bugfixes for SmoothControl pairing --- diff --git a/source/smoothcontrol.cpp b/source/smoothcontrol.cpp index e878ed8..293e0b3 100644 --- a/source/smoothcontrol.cpp +++ b/source/smoothcontrol.cpp @@ -27,6 +27,18 @@ SmoothControl::SmoothControl(Device &d, ControlSrcType t, unsigned i): paired_ctrl(0) { } +SmoothControl &SmoothControl::operator=(const SmoothControl &sc) +{ + Control::operator=(sc); + + return *this; +} + +SmoothControl::~SmoothControl() +{ + pair(0); +} + void SmoothControl::pair(SmoothControl *ctrl) { if(ctrl==paired_ctrl) @@ -34,8 +46,9 @@ void SmoothControl::pair(SmoothControl *ctrl) if(paired_ctrl) { + SmoothControl *old_pair=paired_ctrl; paired_ctrl=0; - paired_ctrl->pair(0); + old_pair->pair(0); } paired_ctrl=ctrl; diff --git a/source/smoothcontrol.h b/source/smoothcontrol.h index 3c41d1c..26484a9 100644 --- a/source/smoothcontrol.h +++ b/source/smoothcontrol.h @@ -34,6 +34,8 @@ public: SmoothControl(); SmoothControl(const ControlSource &); SmoothControl(Device &, ControlSrcType, unsigned); + SmoothControl &operator=(const SmoothControl &); + virtual ~SmoothControl(); void pair(SmoothControl *ctrl); float get_value() const { return value; }