From 271bc05b91772e5aedd834db116734b34f0108a1 Mon Sep 17 00:00:00 2001 From: Nat Goodspeed Date: Fri, 10 May 2024 09:55:19 -0400 Subject: Fix latent access violation in ~LLEventPump() if LLEventPumps gone. Instead of making LLEventPumps an LLHandleProvider, and storing an LLHandle in each LLEventPump instance, just make ~LLEventPump() query LLEventPumps::instanceExists() before calling instance(). --- indra/llcommon/llevents.h | 16 +--------------- 1 file changed, 1 insertion(+), 15 deletions(-) (limited to 'indra/llcommon/llevents.h') diff --git a/indra/llcommon/llevents.h b/indra/llcommon/llevents.h index 1fc0f23ecd..15d1d5035c 100644 --- a/indra/llcommon/llevents.h +++ b/indra/llcommon/llevents.h @@ -53,7 +53,6 @@ #include "llsingleton.h" #include "lldependencies.h" #include "llexception.h" -#include "llhandle.h" // hack for testing #ifndef testable @@ -213,15 +212,7 @@ class LLEventPump; * LLEventPumps is a Singleton manager through which one typically accesses * this subsystem. */ -// LLEventPumps isa LLHandleProvider only for (hopefully rare) long-lived -// class objects that must refer to this class late in their lifespan, say in -// the destructor. Specifically, the case that matters is a possible reference -// after LLEventPumps::deleteSingleton(). (Lingering LLEventPump instances are -// capable of this.) In that case, instead of calling LLEventPumps::instance() -// again -- resurrecting the deleted LLSingleton -- store an -// LLHandle and test it before use. -class LL_COMMON_API LLEventPumps: public LLSingleton, - public LLHandleProvider +class LL_COMMON_API LLEventPumps: public LLSingleton { LLSINGLETON(LLEventPumps); public: @@ -582,12 +573,7 @@ private: virtual void clear(); virtual void reset(); - - private: - // must precede mName; see LLEventPump::LLEventPump() - LLHandle mRegistry; - std::string mName; LLMutex mConnectionListMutex; -- cgit v1.2.3 From 2c687e6d687ead0f29c096271b207dbe16b31c35 Mon Sep 17 00:00:00 2001 From: Nat Goodspeed Date: Fri, 10 May 2024 11:05:56 -0400 Subject: Fix up a few #includes --- indra/llcommon/llevents.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'indra/llcommon/llevents.h') diff --git a/indra/llcommon/llevents.h b/indra/llcommon/llevents.h index 15d1d5035c..2cc1f91408 100644 --- a/indra/llcommon/llevents.h +++ b/indra/llcommon/llevents.h @@ -49,10 +49,11 @@ #endif #include -#include "llsd.h" -#include "llsingleton.h" #include "lldependencies.h" #include "llexception.h" +#include "llmutex.h" +#include "llsd.h" +#include "llsingleton.h" // hack for testing #ifndef testable -- cgit v1.2.3 From 7137647e90d8c11197513f542f04fb39b483d663 Mon Sep 17 00:00:00 2001 From: Nat Goodspeed Date: Wed, 15 May 2024 12:19:54 -0400 Subject: Manual whitespace cleanup (fix_whitespace.py). --- indra/llcommon/llevents.h | 42 +++++++++++++++++++++--------------------- 1 file changed, 21 insertions(+), 21 deletions(-) (limited to 'indra/llcommon/llevents.h') diff --git a/indra/llcommon/llevents.h b/indra/llcommon/llevents.h index 2cc1f91408..d0686bd8b5 100644 --- a/indra/llcommon/llevents.h +++ b/indra/llcommon/llevents.h @@ -6,25 +6,25 @@ * https://wiki.lindenlab.com/wiki/Viewer:Messaging/Event_System, * originally introduced in llnotifications.h. It has nothing * whatsoever to do with the older system in llevent.h. - * + * * $LicenseInfo:firstyear=2008&license=viewerlgpl$ * Second Life Viewer Source Code * Copyright (C) 2010, 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$ */ @@ -39,13 +39,13 @@ #include #include #if LL_WINDOWS - #pragma warning (push) - #pragma warning (disable : 4263) // boost::signals2::expired_slot::what() has const mismatch - #pragma warning (disable : 4264) + #pragma warning (push) + #pragma warning (disable : 4263) // boost::signals2::expired_slot::what() has const mismatch + #pragma warning (disable : 4264) #endif #include #if LL_WINDOWS - #pragma warning (pop) + #pragma warning (pop) #endif #include @@ -290,9 +290,9 @@ public: /** * Find the named LLEventPump instance. If it exists post the message to it. * If the pump does not exist, do nothing. - * + * * returns the result of the LLEventPump::post. If no pump exists returns false. - * + * * This is syntactically similar to LLEventPumps::instance().post(name, message), * however if the pump does not already exist it will not be created. */ @@ -521,10 +521,10 @@ public: * instantiate your listener, then passing the same name on each listen() * call, allows us to optimize away the second and subsequent dependency * sorts. - * - * If name is set to LLEventPump::ANONYMOUS listen will bypass the entire - * dependency and ordering calculation. In this case, it is critical that - * the result be assigned to a LLTempBoundListener or the listener is + * + * If name is set to LLEventPump::ANONYMOUS listen will bypass the entire + * dependency and ordering calculation. In this case, it is critical that + * the result be assigned to a LLTempBoundListener or the listener is * manually disconnected when no longer needed since there will be no * way to later find and disconnect this listener manually. */ @@ -582,7 +582,7 @@ protected: virtual LLBoundListener listen_impl(const std::string& name, const LLEventListener&, const NameList& after, const NameList& before); - + /// implement the dispatching std::shared_ptr mSignal; @@ -635,21 +635,21 @@ public: * by all listeners, until some listener consumes it. The caveat is that each * event *must* eventually reach a listener that will consume it, else the * queue will grow to arbitrary length. - * + * * @NOTE: When using an LLEventMailDrop with an LLEventTimeout or * LLEventFilter attaching the filter downstream, using Timeout's constructor will - * cause the MailDrop to discharge any of its stored events. The timeout should - * instead be connected upstream using its listen() method. + * cause the MailDrop to discharge any of its stored events. The timeout should + * instead be connected upstream using its listen() method. */ class LL_COMMON_API LLEventMailDrop : public LLEventStream { public: LLEventMailDrop(const std::string& name, bool tweak = false) : LLEventStream(name, tweak) {} virtual ~LLEventMailDrop() {} - + /// Post an event to all listeners virtual bool post(const LLSD& event) override; - + /// Remove any history stored in the mail drop. void discard(); -- cgit v1.2.3