]> git.tdb.fi Git - libs/gui.git/commitdiff
Bugfixes for SmoothControl pairing
authorMikko Rasa <tdb@tdb.fi>
Wed, 26 Sep 2007 17:20:50 +0000 (17:20 +0000)
committerMikko Rasa <tdb@tdb.fi>
Wed, 26 Sep 2007 17:20:50 +0000 (17:20 +0000)
source/smoothcontrol.cpp
source/smoothcontrol.h

index e878ed850a76d9432368d280bf2d47dd5174af10..293e0b3dcba7bf985dfe59904ad5fb7ae01682c3 100644 (file)
@@ -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;
index 3c41d1ca8d1c1f410bc92d8b2b18d1d820ff7846..26484a912c4a2b0615a47bc45d0b6376a919d4db 100644 (file)
@@ -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; }