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.
This commit is contained in:
Nat Goodspeed
2026-01-05 19:34:44 +02:00
committed by Andrey Kleshchev
parent bedd3da7c6
commit 9d684bc924
8 changed files with 66 additions and 7 deletions
+1
View File
@@ -68,6 +68,7 @@ set(llcommon_SOURCE_FILES
llmetricperformancetester.cpp
llmortician.cpp
llmutex.cpp
llpointer.cpp
llptrto.cpp
llpredicate.cpp
llprocess.cpp
+43
View File
@@ -0,0 +1,43 @@
/**
* @file llpointer.cpp
* @author Nat Goodspeed
* @date 2024-09-26
* @brief Implementation for llpointer.
*
* $LicenseInfo:firstyear=2024&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2024, Linden Research, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
// Precompiled header
#include "linden_common.h"
// associated header
#include "llpointer.h"
// STL headers
// std headers
// external library headers
// other Linden headers
#include "llerror.h"
void LLPointerBase::wild_dtor(std::string_view msg)
{
// LL_WARNS() << msg << LL_ENDL;
llassert_msg(false, msg);
}
+14 -5
View File
@@ -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();
}
}
+3 -2
View File
@@ -27,10 +27,11 @@
#ifndef LL_LLIMAGE_H
#define LL_LLIMAGE_H
#include "lluuid.h"
#include "llstring.h"
#include "llmutex.h"
#include "llpointer.h"
#include "llstring.h"
#include "lltrace.h"
#include "lluuid.h"
constexpr S32 MIN_IMAGE_MIP = 2; // 4x4, only used for expand/contract power of 2
constexpr S32 MAX_IMAGE_MIP = 12; // 4096x4096
+1
View File
@@ -25,6 +25,7 @@
#include "linden_common.h"
#include "llmutex.h"
#include "llvolumemgr.h"
#include "llvolume.h"
@@ -24,6 +24,8 @@
* $/LicenseInfo$
*/
#include "linden_common.h"
#include "lltexturemanagerbridge.h"
// Define a null texture manager bridge. Applications must provide their own bridge implementaton.
+1
View File
@@ -93,6 +93,7 @@
#include "llinitparam.h"
#include "llinstancetracker.h"
#include "llmortician.h"
#include "llmutex.h"
#include "llnotificationptr.h"
#include "llpointer.h"
#include "llrefcount.h"
+1
View File
@@ -27,6 +27,7 @@
#include "llviewerprecompiledheaders.h"
#include "llwatchdog.h"
#include "llmutex.h"
#include "llthread.h"
#include "llappviewer.h"