Commit c9260515 authored by Tomáš Oberhuber's avatar Tomáš Oberhuber
Browse files

Fixed assignment of nullptr initialized SharedPointer.

parent 37b353f4
Loading
Loading
Loading
Loading
+4 −2
Original line number Diff line number Diff line
@@ -191,6 +191,7 @@ class SharedPointer< Object, Devices::Cuda > : public SmartPointer
      {
         this->free();
         this->pd = (PointerData*) ptr.pd;
         if( this->pd != nullptr ) 
            this->pd->counter += 1;
         return *this;
      }
@@ -202,6 +203,7 @@ class SharedPointer< Object, Devices::Cuda > : public SmartPointer
      {
         this->free();
         this->pd = (PointerData*) ptr.pd;
         if( this->pd != nullptr ) 
            this->pd->counter += 1;
         return *this;
      }
+4 −2
Original line number Diff line number Diff line
@@ -163,6 +163,7 @@ class SharedPointer< Object, Devices::Host > : public SmartPointer
      {
         this->free();
         this->pd = (PointerData*) ptr.pd;
         if( this->pd != nullptr )
            this->pd->counter += 1;
         return *this;
      }
@@ -174,6 +175,7 @@ class SharedPointer< Object, Devices::Host > : public SmartPointer
      {
         this->free();
         this->pd = (PointerData*) ptr.pd;
         if( this->pd != nullptr )
            this->pd->counter += 1;
         return *this;
      }
+4 −2
Original line number Diff line number Diff line
@@ -186,6 +186,7 @@ class SharedPointer< Object, Devices::MIC > : public SmartPointer
         this->free();
         this->pd = (PointerData*) ptr.pd;
         this->mic_pointer = ptr.mic_pointer;
         if( this->pd != nullptr )
            this->pd->counter += 1;
#ifdef TNL_DEBUG_SHARED_POINTERS
         std::cerr << "Copy-assigned shared pointer: counter = " << this->pd->counter << ", type: " << demangle(typeid(ObjectType).name()) << std::endl;
@@ -201,6 +202,7 @@ class SharedPointer< Object, Devices::MIC > : public SmartPointer
         this->free();
         this->pd = (PointerData*) ptr.pd;
         this->mic_pointer = ptr.mic_pointer;
         if( this->pd != nullptr )
            this->pd->counter += 1;
#ifdef TNL_DEBUG_SHARED_POINTERS
         std::cerr << "Copy-assigned shared pointer: counter = " << this->pd->counter << ", type: " << demangle(typeid(ObjectType).name()) << std::endl;