remove reference counting in widgets
authorozantonkal <ozantonkal@gmail.com>
Sat, 24 Aug 2013 13:12:16 +0000 (15:12 +0200)
committerOzan Tonkal <ozantonkal@gmail.com>
Thu, 5 Sep 2013 18:56:33 +0000 (20:56 +0200)
modules/viz/include/opencv2/viz/widgets.hpp
modules/viz/src/widget.cpp

index 99f4bd42071056d044754512c2b76d8406307575..caaee9e6988310c68f584aabfb6d3fbeac7e9a4a 100644 (file)
@@ -14,9 +14,6 @@ namespace cv
         {
         public:
             Widget();
-            Widget(const Widget &other);
-            Widget& operator =(const Widget &other);
-            ~Widget();
             
             static Widget fromPlyFile(const String &file_name);
             
@@ -28,9 +25,6 @@ namespace cv
             class Impl;
             Impl *impl_;
             friend struct WidgetAccessor;
-
-            void create();
-            void release();
         };
 
         /////////////////////////////////////////////////////////////////////////////
index 808e3f047b982e960b84245fb2c44b3bb2ed1602..485e35ed74b5cfcf4b593c6006c666d85e8c3505 100644 (file)
@@ -7,52 +7,11 @@ class cv::viz::Widget::Impl
 {
 public:
     vtkSmartPointer<vtkProp> prop;
-    int ref_counter;
     
     Impl() : prop(0) {}
 };
 
-cv::viz::Widget::Widget() : impl_(0)
-{
-    create();
-}
-
-cv::viz::Widget::Widget(const Widget &other) : impl_(other.impl_) 
-{
-    if (impl_) CV_XADD(&impl_->ref_counter, 1);
-}
-
-cv::viz::Widget& cv::viz::Widget::operator=(const Widget &other)
-{
-    if (this != &other)
-    {
-        release();
-        impl_ = other.impl_;
-        if (impl_) CV_XADD(&impl_->ref_counter, 1);
-    }
-    return *this;
-}
-
-cv::viz::Widget::~Widget()
-{
-    release();
-}
-
-void cv::viz::Widget::create()
-{
-    if (impl_) release();
-    impl_ = new Impl();
-    impl_->ref_counter = 1;
-}
-
-void cv::viz::Widget::release()
-{
-    if (impl_ && CV_XADD(&impl_->ref_counter, -1) == 1)
-    {
-        delete impl_;
-        impl_ = 0;
-    }
-}
+cv::viz::Widget::Widget() : impl_( new Impl() ) { }
 
 cv::viz::Widget cv::viz::Widget::fromPlyFile(const String &file_name)
 {