From 0fa5991d067304d103d8bd18702e3e8806de07e3 Mon Sep 17 00:00:00 2001 From: AiraYumi Date: Sun, 23 Nov 2025 12:42:57 +0900 Subject: Prevent the creation of temporary objects that will be discarded. --- indra/newview/llpathfindingnavmesh.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'indra') diff --git a/indra/newview/llpathfindingnavmesh.cpp b/indra/newview/llpathfindingnavmesh.cpp index c9fbeba2f3..5bb33a65f2 100644 --- a/indra/newview/llpathfindingnavmesh.cpp +++ b/indra/newview/llpathfindingnavmesh.cpp @@ -139,7 +139,8 @@ void LLPathfindingNavMesh::handleNavMeshResult(const LLSD &pContent, U32 pNavMes ENavMeshRequestStatus status; if ( pContent.has(NAVMESH_DATA_FIELD) ) { - const LLSD::Binary &value = pContent.get(NAVMESH_DATA_FIELD).asBinary(); + LLSD nav_data = pContent.get(NAVMESH_DATA_FIELD); + const LLSD::Binary& value = nav_data.asBinary(); auto binSize = value.size(); std::string newStr(reinterpret_cast(&value[0]), binSize); std::istringstream streamdecomp( newStr ); -- cgit v1.3 From 0ea816a6c26e17bf0a2ee8274363837d4bd0ef94 Mon Sep 17 00:00:00 2001 From: Rye Date: Thu, 27 Nov 2025 11:41:03 -0500 Subject: Replace dependency on boost thread with std and change HttpService to use a similar thread shutdown mechanism to LLThread --- indra/cmake/Boost.cmake | 9 ---- indra/llcorehttp/_httpservice.cpp | 47 +++++++++--------- indra/llcorehttp/_httpservice.h | 2 +- indra/llcorehttp/_mutex.h | 11 ++--- indra/llcorehttp/_refcounted.h | 8 +-- indra/llcorehttp/_thread.h | 100 ++++++++++++++++---------------------- 6 files changed, 75 insertions(+), 102 deletions(-) (limited to 'indra') diff --git a/indra/cmake/Boost.cmake b/indra/cmake/Boost.cmake index 610a4f6232..5967a96f8a 100644 --- a/indra/cmake/Boost.cmake +++ b/indra/cmake/Boost.cmake @@ -65,14 +65,6 @@ find_library(BOOST_SYSTEM_LIBRARY boost_system-mt${addrsfx} PATHS "${ARCH_PREBUILT_DIRS_RELEASE}" REQUIRED NO_DEFAULT_PATH) -find_library(BOOST_THREAD_LIBRARY - NAMES - libboost_thread-mt - libboost_thread-mt${addrsfx} - boost_thread-mt - boost_thread-mt${addrsfx} - PATHS "${ARCH_PREBUILT_DIRS_RELEASE}" REQUIRED NO_DEFAULT_PATH) - find_library(BOOST_URL_LIBRARY NAMES libboost_url-mt @@ -88,7 +80,6 @@ target_link_libraries(ll::boost INTERFACE ${BOOST_PROGRAMOPTIONS_LIBRARY} ${BOOST_REGEX_LIBRARY} ${BOOST_SYSTEM_LIBRARY} - ${BOOST_THREAD_LIBRARY} ${BOOST_URL_LIBRARY}) if (LINUX) diff --git a/indra/llcorehttp/_httpservice.cpp b/indra/llcorehttp/_httpservice.cpp index 03a2eab8e3..323a18c02a 100644 --- a/indra/llcorehttp/_httpservice.cpp +++ b/indra/llcorehttp/_httpservice.cpp @@ -71,7 +71,6 @@ volatile HttpService::EState HttpService::sState(NOT_INITIALIZED); HttpService::HttpService() : mRequestQueue(NULL), mExitRequested(0U), - mThread(NULL), mPolicy(NULL), mTransport(NULL), mLastPolicy(0) @@ -90,23 +89,30 @@ HttpService::~HttpService() { if (mRequestQueue->stopQueue()) { - // Give mRequestQueue a chance to finish - ms_sleep(10); + // Now wait a bit for the thread to exit + S32 counter = 0; + const S32 MAX_WAIT = 600; + while (counter < MAX_WAIT) + { + if (STOPPED == sState) + { + break; + } + // Sleep for a tenth of a second + ms_sleep(100); + std::this_thread::yield(); + counter++; + } } } - if (mThread) + if (mThread && RUNNING == sState) { - if (! mThread->timedJoin(250)) - { - // Failed to join, expect problems ahead so do a hard termination. - LL_WARNS(LOG_CORE) << "Destroying HttpService with running thread. Expect problems." << LL_NEWLINE - << "State: " << S32(sState) - << " Last policy: " << U32(mLastPolicy) - << LL_ENDL; + // Failed to shutdown, expect problems ahead so do a hard termination. + LL_WARNS(LOG_CORE) << "Destroying HttpService with running thread. Expect problems." << LL_NEWLINE << "State: " << S32(sState) + << " Last policy: " << U32(mLastPolicy) << LL_ENDL; - mThread->cancel(); - } + mThread->cancel(); } } @@ -122,11 +128,7 @@ HttpService::~HttpService() delete mPolicy; mPolicy = NULL; - if (mThread) - { - mThread->release(); - mThread = NULL; - } + mThread.reset(); } @@ -205,14 +207,15 @@ void HttpService::startThread() if (mThread) { - mThread->release(); + mThread.reset(); } // Push current policy definitions, enable policy & transport components mPolicy->start(); mTransport->start(mLastPolicy + 1); - mThread = new LLCoreInt::HttpThread(boost::bind(&HttpService::threadRun, this, _1)); + mThread = std::make_unique(boost::bind(&HttpService::threadRun, this, _1)); + mThread->detach(); // Detach thread to let it clean its self up sState = RUNNING; } @@ -286,8 +289,6 @@ void HttpService::threadRun(LLCoreInt::HttpThread * thread) set_thread_name("HttpService"); LL_PROFILER_SET_THREAD_NAME("HttpService"); - boost::this_thread::disable_interruption di; - ELoopSpeed loop(REQUEST_SLEEP); while (! mExitRequested) { @@ -314,7 +315,7 @@ void HttpService::threadRun(LLCoreInt::HttpThread * thread) { LOG_UNHANDLED_EXCEPTION(""); } - catch (std::bad_alloc&) + catch (const std::bad_alloc&) { LLMemory::logMemoryInfo(true); diff --git a/indra/llcorehttp/_httpservice.h b/indra/llcorehttp/_httpservice.h index 13eb034f0e..bdf03f5227 100644 --- a/indra/llcorehttp/_httpservice.h +++ b/indra/llcorehttp/_httpservice.h @@ -218,7 +218,7 @@ protected: static volatile EState sState; HttpRequestQueue * mRequestQueue; // Refcounted LLAtomicU32 mExitRequested; - LLCoreInt::HttpThread * mThread; + std::unique_ptr mThread; // === working-thread-only data === HttpPolicy * mPolicy; // Simple pointer, has ownership diff --git a/indra/llcorehttp/_mutex.h b/indra/llcorehttp/_mutex.h index 5e0164eb51..43782d3a37 100644 --- a/indra/llcorehttp/_mutex.h +++ b/indra/llcorehttp/_mutex.h @@ -27,9 +27,8 @@ #ifndef LLCOREINT_MUTEX_H_ #define LLCOREINT_MUTEX_H_ - -#include - +#include +#include namespace LLCoreInt { @@ -37,17 +36,17 @@ namespace LLCoreInt // MUTEX TYPES // unique mutex type -typedef boost::mutex HttpMutex; +typedef std::mutex HttpMutex; // CONDITION VARIABLES // standard condition variable -typedef boost::condition_variable HttpConditionVariable; +typedef std::condition_variable HttpConditionVariable; // LOCKS AND FENCES // scoped unique lock -typedef boost::unique_lock HttpScopedLock; +typedef std::unique_lock HttpScopedLock; } diff --git a/indra/llcorehttp/_refcounted.h b/indra/llcorehttp/_refcounted.h index 7470965a7f..45fe3cb090 100644 --- a/indra/llcorehttp/_refcounted.h +++ b/indra/llcorehttp/_refcounted.h @@ -43,11 +43,11 @@ namespace LLCoreInt class RefCounted { -private: - RefCounted(); // Not defined - may not be default constructed - void operator=(const RefCounted &); // Not defined - public: + RefCounted() = delete; // Not defined - may not be default constructed + RefCounted(const RefCounted&) = delete; // Not defined - may not be copy constructed + void operator=(const RefCounted&) = delete; // Not defined + explicit RefCounted(bool const implicit) : mRefCount(implicit) {} diff --git a/indra/llcorehttp/_thread.h b/indra/llcorehttp/_thread.h index 6c0e39cf92..956a220524 100644 --- a/indra/llcorehttp/_thread.h +++ b/indra/llcorehttp/_thread.h @@ -29,92 +29,74 @@ #include "linden_common.h" -#include -#include -#include +#include +#include -#include "apr.h" // thread-related functions #include "_refcounted.h" namespace LLCoreInt { -class HttpThread : public RefCounted +class HttpThread { -private: - HttpThread(); // Not defined - void operator=(const HttpThread &); // Not defined - - void at_exit() - { - // the thread function has exited so we need to release our reference - // to ourself so that we will be automagically cleaned up. - release(); - } +public: + HttpThread() = delete; // Not defined + void operator=(const HttpThread &) = delete; // Not defined +private: void run() - { // THREAD CONTEXT - - // Take out additional reference for the at_exit handler - addRef(); - boost::this_thread::at_thread_exit(boost::bind(&HttpThread::at_exit, this)); - - // run the thread function - mThreadFunc(this); - - } // THREAD CONTEXT - -protected: - virtual ~HttpThread() - { - delete mThread; - } + { // THREAD CONTEXT + // run the thread function + mThreadFunc(this); + } // THREAD CONTEXT public: /// Constructs a thread object for concurrent execution but does /// not start running. Caller receives on refcount on the thread /// instance. If the thread is started, another will be taken /// out for the exit handler. - explicit HttpThread(boost::function threadFunc) - : RefCounted(true), // implicit reference - mThreadFunc(threadFunc) - { - // this creates a boost thread that will call HttpThread::run on this instance - // and pass it the threadfunc callable... - boost::function f = boost::bind(&HttpThread::run, this); + explicit HttpThread(std::function threadFunc) + : mThreadFunc(threadFunc) + { + // this creates a std thread that will call HttpThread::run on this instance + // and pass it the threadfunc callable... + std::function f = std::bind(&HttpThread::run, this); - mThread = new boost::thread(f); - } + mThread = std::make_unique(f); + mNativeHandle = mThread->native_handle(); + } - inline void join() - { - mThread->join(); - } + ~HttpThread() = default; - inline bool timedJoin(S32 millis) - { - return mThread->timed_join(boost::posix_time::milliseconds(millis)); - } + inline void join() + { + mThread->join(); + } inline bool joinable() const - { - return mThread->joinable(); - } + { + return mThread->joinable(); + } + + inline void detach() + { + mThread->detach(); + } // A very hostile method to force a thread to quit inline void cancel() - { - boost::thread::native_handle_type thread(mThread->native_handle()); -#if LL_WINDOWS - TerminateThread(thread, 0); + { +#if LL_WINDOWS + TerminateThread(mNativeHandle, 0); #else - pthread_cancel(thread); + pthread_cancel(mNativeHandle); #endif - } + } private: - boost::function mThreadFunc; - boost::thread * mThread; + std::function mThreadFunc; + std::unique_ptr mThread; + std::thread::native_handle_type mNativeHandle; }; // end class HttpThread } // end namespace LLCoreInt -- cgit v1.3 From ed561bfc3c769f8733ad75a70e975d81dcd9d007 Mon Sep 17 00:00:00 2001 From: Rye Date: Sun, 9 Nov 2025 21:08:03 -0500 Subject: Fix failure to generate build config information correctly under some cmake generators due to CMAKE_BUILD_TYPE only being utilized by non-multiconfig Signed-off-by: Rye --- indra/newview/llversioninfo.cpp | 11 +++++++++-- indra/newview/llversioninfo.h | 1 - indra/newview/llversioninfovars.h.in | 1 - 3 files changed, 9 insertions(+), 4 deletions(-) (limited to 'indra') diff --git a/indra/newview/llversioninfo.cpp b/indra/newview/llversioninfo.cpp index cbd63184e9..0fb18c28ae 100644 --- a/indra/newview/llversioninfo.cpp +++ b/indra/newview/llversioninfo.cpp @@ -54,7 +54,6 @@ LLVersionInfo::LLVersionInfo(): // macro expands to the string name of the channel, but without quotes. We // need to turn it into a quoted string. LL_TO_STRING() does that. mWorkingChannelName(LL_TO_STRING(LL_VIEWER_CHANNEL)), - build_configuration(LLBUILD_CONFIG), // set in indra/cmake/BuildVersion.cmake // instantiate an LLEventMailDrop with canonical name to listen for news // from SLVersionChecker mPump{new LLEventMailDrop("relnotes")}, @@ -170,7 +169,15 @@ LLVersionInfo::ViewerMaturity LLVersionInfo::getViewerMaturity() const std::string LLVersionInfo::getBuildConfig() const { - return build_configuration; +#if LL_DEBUG + return "Debug"; +#elif LL_RELEASE_WITH_DEBUG_INFO + return "RelWithDebInfo"; +#elif LL_RELEASE_FOR_DOWNLOAD + return "Release"; +#else + return "Unknown"; +#endif } std::string LLVersionInfo::getReleaseNotes() const diff --git a/indra/newview/llversioninfo.h b/indra/newview/llversioninfo.h index 237b37a084..8c384565e4 100644 --- a/indra/newview/llversioninfo.h +++ b/indra/newview/llversioninfo.h @@ -108,7 +108,6 @@ private: // Storage for the "version and channel" string. // This will get reset too. mutable std::string mVersionChannel; - std::string build_configuration; std::string mReleaseNotes; // Store unique_ptrs to the next couple things so we don't have to explain // to every consumer of this header file all the details of each. diff --git a/indra/newview/llversioninfovars.h.in b/indra/newview/llversioninfovars.h.in index fe834406e6..2984f05bb3 100644 --- a/indra/newview/llversioninfovars.h.in +++ b/indra/newview/llversioninfovars.h.in @@ -28,4 +28,3 @@ #define LL_VIEWER_VERSION_MINOR @VIEWER_VERSION_MINOR@ #define LL_VIEWER_VERSION_PATCH @VIEWER_VERSION_PATCH@ #define LL_VIEWER_VERSION_BUILD @VIEWER_VERSION_REVISION@ -#define LLBUILD_CONFIG "@CMAKE_BUILD_TYPE@" -- cgit v1.3 From e1174d206c38821b23752d2f66aa5fd8f815232a Mon Sep 17 00:00:00 2001 From: Rye Date: Mon, 17 Nov 2025 05:44:55 -0500 Subject: Remove leftover boost aligned_allocator as this is now handled by c++17 aligned allocations Signed-off-by: Rye --- indra/llprimitive/llmodel.h | 2 -- indra/llrender/llrender.h | 5 ++--- 2 files changed, 2 insertions(+), 5 deletions(-) (limited to 'indra') diff --git a/indra/llprimitive/llmodel.h b/indra/llprimitive/llmodel.h index 26448069c6..d624b6dc7a 100644 --- a/indra/llprimitive/llmodel.h +++ b/indra/llprimitive/llmodel.h @@ -33,8 +33,6 @@ #include "m4math.h" #include -#include - class daeElement; class domMesh; diff --git a/indra/llrender/llrender.h b/indra/llrender/llrender.h index 4bfc5723ee..9c17cf3470 100644 --- a/indra/llrender/llrender.h +++ b/indra/llrender/llrender.h @@ -43,7 +43,6 @@ #include "llglheaders.h" #include "llmatrix4a.h" #include "glm/mat4x4.hpp" -#include #include #include @@ -531,8 +530,8 @@ private: eBlendFactor mCurrBlendAlphaSFactor; eBlendFactor mCurrBlendAlphaDFactor; - std::vector > mUIOffset; - std::vector > mUIScale; + std::vector mUIOffset; + std::vector mUIScale; struct LLVBCache { -- cgit v1.3 From ec8dc90855dafe6abc818f1acf5f38a770009324 Mon Sep 17 00:00:00 2001 From: Rye Date: Thu, 27 Nov 2025 07:42:19 -0500 Subject: Optimize post process rendering for gltf material preview Signed-off-by: Rye --- indra/newview/llgltfmaterialpreviewmgr.cpp | 4 ---- 1 file changed, 4 deletions(-) (limited to 'indra') diff --git a/indra/newview/llgltfmaterialpreviewmgr.cpp b/indra/newview/llgltfmaterialpreviewmgr.cpp index e7b988aef5..446742f316 100644 --- a/indra/newview/llgltfmaterialpreviewmgr.cpp +++ b/indra/newview/llgltfmaterialpreviewmgr.cpp @@ -520,21 +520,17 @@ bool LLGLTFPreviewTexture::render() // *HACK: Hide mExposureMap from generateExposure gPipeline.mExposureMap.swapFBORefs(gPipeline.mLastExposure); - gPipeline.copyScreenSpaceReflections(&screen, &gPipeline.mSceneMap); gPipeline.generateLuminance(&screen, &gPipeline.mLuminanceMap); gPipeline.generateExposure(&gPipeline.mLuminanceMap, &gPipeline.mExposureMap, /*use_history = */ false); gPipeline.gammaCorrect(&screen, &gPipeline.mPostPingMap); LLVertexBuffer::unbind(); gPipeline.generateGlow(&gPipeline.mPostPingMap); gPipeline.combineGlow(&gPipeline.mPostPingMap, &screen); - gPipeline.renderDoF(&screen, &gPipeline.mPostPingMap); - gPipeline.applyFXAA(&gPipeline.mPostPingMap, &screen); // *HACK: Restore mExposureMap (it will be consumed by generateExposure next frame) gPipeline.mExposureMap.swapFBORefs(gPipeline.mLastExposure); // Final render - gDeferredPostNoDoFProgram.bind(); // From LLPipeline::renderFinalize: "Whatever is last in the above post processing chain should _always_ be rendered directly here. If not, expect problems." -- cgit v1.3 From b49400e0882a80dd2972a31cde2152ba979b2ce4 Mon Sep 17 00:00:00 2001 From: Rye Date: Tue, 2 Dec 2025 16:44:03 -0500 Subject: Fix invalid symbol in gstreamer 1.0 plugin crashing (#5059) Signed-off-by: Rye --- indra/media_plugins/gstreamer10/llmediaimplgstreamer_syms_raw.inc | 2 +- indra/media_plugins/gstreamer10/media_plugin_gstreamer10.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'indra') diff --git a/indra/media_plugins/gstreamer10/llmediaimplgstreamer_syms_raw.inc b/indra/media_plugins/gstreamer10/llmediaimplgstreamer_syms_raw.inc index 6f5bb04bdf..e3b959f2b6 100644 --- a/indra/media_plugins/gstreamer10/llmediaimplgstreamer_syms_raw.inc +++ b/indra/media_plugins/gstreamer10/llmediaimplgstreamer_syms_raw.inc @@ -32,7 +32,7 @@ LL_GRAB_SYM(G, false, gst_registry_fork_set_enabled, void, gboolean enabled) LL_GRAB_SYM(G, false, gst_segtrap_set_enabled, void, gboolean enabled) LL_GRAB_SYM(G, false, gst_message_parse_buffering, void, GstMessage *message, gint *percent) LL_GRAB_SYM(G, false, gst_message_parse_info, void, GstMessage *message, GError **gerror, gchar **debug) -LL_GRAB_SYM(G, false, gst_element_query_position, gboolean, GstElement *element, GstFormat *format, gint64 *cur) +LL_GRAB_SYM(G, false, gst_element_query_position, gboolean, GstElement *element, GstFormat format, gint64 *cur) LL_GRAB_SYM(G, false, gst_version, void, guint *major, guint *minor, guint *micro, guint *nano) LL_GRAB_SYM(G, true, gst_message_parse_tag, void, GstMessage *, GstTagList **) diff --git a/indra/media_plugins/gstreamer10/media_plugin_gstreamer10.cpp b/indra/media_plugins/gstreamer10/media_plugin_gstreamer10.cpp index 0f45c151a2..5fdea56920 100644 --- a/indra/media_plugins/gstreamer10/media_plugin_gstreamer10.cpp +++ b/indra/media_plugins/gstreamer10/media_plugin_gstreamer10.cpp @@ -506,7 +506,7 @@ bool MediaPluginGStreamer10::getTimePos(double &sec_out) got_position = llgst_element_query_position && llgst_element_query_position(mPlaybin, - &timefmt, + timefmt, &pos); got_position = got_position && (timefmt == GST_FORMAT_TIME); -- cgit v1.3