ryzom / ryzomcore

Ryzom Core is the open-source project related to the Ryzom game. This community repository is synchronized with the Ryzom Forge repository, based on the Core branch.
https://wiki.ryzom.dev
GNU Affero General Public License v3.0
337 stars 90 forks source link

gcc warning about CRefPtr #679

Closed nimetu closed 1 year ago

nimetu commented 1 year ago
[24/1242] Building CXX object nel/src/misc/CMakeFiles/nelmisc.dir/cdb_branch_observing_handler.cpp.o
In file included from nel/include/nel/misc/smart_ptr.h:919,
                 from nel/include/nel/misc/cdb.h:27,
                 from nel/include/nel/misc/cdb_branch.h:26,
                 from nel/include/nel/misc/cdb_branch_observing_handler.h:23,
                 from nel/src/misc/cdb_branch_observing_handler.cpp:21:
In member function ‘void NLMISC::CRefPtr<T>::unRef() const [with T = NLMISC::ICDBNode::IPropertyObserver]’,
    inlined from ‘NLMISC::CRefPtr<T>::~CRefPtr() [with T = NLMISC::ICDBNode::IPropertyObserver]’ at nel/include/nel/misc/smart_ptr_inline.h:189:7,
    inlined from ‘NLMISC::CCDBBranchObservingHandler::CCDBDBBranchObserverHandle::~CCDBDBBranchObserverHandle()’ at nel/src/misc/cdb_branch_observing_handler.cpp:150:2:
nel/include/nel/misc/smart_ptr_inline.h:140:25: warning: ‘void operator delete(void*)’ called on unallocated object ‘NLMISC::CRefCount::NullPtrInfo’ [-Wfree-nonheap-object]
  140 |                         delete pinfo;
      |                         ^~~~~~~~~~~~
In file included from nel/include/nel/misc/cdb.h:27,
                 from nel/include/nel/misc/cdb_branch.h:26,
                 from nel/include/nel/misc/cdb_branch_observing_handler.h:23,
                 from nel/src/misc/cdb_branch_observing_handler.cpp:21:
nel/include/nel/misc/smart_ptr.h: In destructor ‘NLMISC::CCDBBranchObservingHandler::CCDBDBBranchObserverHandle::~CCDBDBBranchObserverHandle()’:
nel/include/nel/misc/smart_ptr.h:69:33: note: declared here
   69 |         static  CPtrInfoBase    NullPtrInfo;
kaetemi commented 1 year ago

Not sure if that fixes the error, but it's more correct I suppose :)

kaetemi commented 1 year ago

That change won't build under VS2008, and might break NullPtrInfo initialization order, actually...

kaetemi commented 1 year ago

Better fix. :)

nimetu commented 1 year ago

This is fixed.

thanks,