summaryrefslogtreecommitdiff
path: root/indra/llcommon/llpointer.h
diff options
context:
space:
mode:
authorNat Goodspeed <nat@lindenlab.com>2024-09-27 05:38:39 -0400
committerAndrey Kleshchev <117672381+akleshchev@users.noreply.github.com>2026-01-05 19:34:44 +0200
commit9d684bc9241cca4aae79d93886d0f95dcee26d65 (patch)
tree637318a1fe2cf68256e99b8df5b8a3813bdaebb9 /indra/llcommon/llpointer.h
parentbedd3da7c60c1615cd5102438822e8f186d4426a (diff)
Migrate ~LLPointer()'s peculiar warning case to llpointer.cpp.
This allows removing #include "llerror.h" from llpointer.h. Also remove #include "llmutex.h" as a heavy way to get <boost/functional/hash.hpp>. That requires adding #include "llmutex.h" to llimage.h, llnotifications.h, llwatchdog.cpp and llvolumemgr.cpp, which were inheriting it from llpointer.h.
Diffstat (limited to 'indra/llcommon/llpointer.h')
-rw-r--r--indra/llcommon/llpointer.h19
1 files changed, 14 insertions, 5 deletions
diff --git a/indra/llcommon/llpointer.h b/indra/llcommon/llpointer.h
index 71c955c4c5..77c02fab11 100644
--- a/indra/llcommon/llpointer.h
+++ b/indra/llcommon/llpointer.h
@@ -26,8 +26,8 @@
#ifndef LLPOINTER_H
#define LLPOINTER_H
-#include "llerror.h" // *TODO: consider eliminating this
-#include "llmutex.h"
+#include <boost/functional/hash.hpp>
+#include <string_view>
#include <utility> // std::swap()
//----------------------------------------------------------------------------
@@ -43,8 +43,18 @@
//----------------------------------------------------------------------------
+class LLPointerBase
+{
+protected:
+ // alert the coder that a referenced type's destructor did something very
+ // strange -- this is in a non-template base class so we can hide the
+ // implementation in llpointer.cpp
+ static void wild_dtor(std::string_view msg);
+};
+
// Note: relies on Type having ref() and unref() methods
-template <class Type> class LLPointer
+template <class Type>
+class LLPointer: public LLPointerBase
{
public:
template<typename Subclass>
@@ -106,7 +116,6 @@ public:
const Type& operator*() const { return *mPointer; }
Type& operator*() { return *mPointer; }
- operator BOOL() const { return (mPointer != nullptr); }
operator bool() const { return (mPointer != nullptr); }
bool operator!() const { return (mPointer == nullptr); }
bool isNull() const { return (mPointer == nullptr); }
@@ -210,7 +219,7 @@ protected:
temp->unref();
if (mPointer != nullptr)
{
- LL_WARNS() << "Unreference did assignment to non-NULL because of destructor" << LL_ENDL;
+ wild_dtor("Unreference did assignment to non-NULL because of destructor");
unref();
}
}