Commit Graph

3393 Commits (bd008a170898e69beeb8bc0481b4bfd94de86c55)

Author SHA1 Message Date
Nat Goodspeed 218c0a1d4f Automated merge with ssh://bitbucket.org/nat_linden/viewer-llsingleton 2019-12-13 13:20:21 -05:00
Nat Goodspeed 24499ac66f Automated merge with ssh://bitbucket.org/lindenlab/viewer-release 2019-12-13 12:30:03 -05:00
Nat Goodspeed b2913b7cf1 DRTVWR-494: Defend LLInstanceTracker against multi-thread usage.
The previous implementation went to some effort to crash if anyone attempted
to create or destroy an LLInstanceTracker subclass instance during traversal.
That restriction is manageable within a single thread, but becomes unworkable
if it's possible that a given subclass might be used on more than one thread.

Remove LLInstanceTracker::instance_iter, beginInstances(), endInstances(),
also key_iter, beginKeys() and endKeys(). Instead, introduce key_snapshot()
and instance_snapshot(), the only means of iterating over LLInstanceTracker
instances. (These are intended to resemble functions, but in fact the current
implementation simply presents the classes.) Iterating over a captured
snapshot defends against container modifications during traversal. The term
'snapshot' reminds the coder that a new instance created during traversal will
not be considered. To defend against instance deletion during traversal, a
snapshot stores std::weak_ptrs which it lazily dereferences, skipping on the
fly any that have expired.

Dereferencing instance_snapshot::iterator gets you a reference rather than a
pointer. Because some use cases want to delete all existing instances, add an
instance_snapshot::deleteAll() method that extracts the pointer. Those cases
used to require explicitly copying instance pointers into a separate
container; instance_snapshot() now takes care of that. It remains the caller's
responsibility to ensure that all instances of that LLInstanceTracker subclass
were allocated on the heap.

Replace unkeyed static LLInstanceTracker::getInstance(T*) -- which returned
nullptr if that instance had been destroyed -- with new getWeak() method
returning std::weak_ptr<T>. Caller must detect expiration of that weak_ptr.

Adjust tests accordingly.

Use of std::weak_ptr to detect expired instances requires engaging
std::shared_ptr in the constructor. We now store shared_ptrs in the static
containers (std::map for keyed, std::set for unkeyed).

Make LLInstanceTrackerBase a template parameterized on the type of the static
data it manages. For that reason, hoist static data class declarations out of
the class definitions to an LLInstanceTrackerStuff namespace.

Remove the static atomic sIterationNestDepth and its methods incrementDepth(),
decrementDepth() and getDepth(), since they were used only to forbid creation
and destruction during traversal.

Add a std::mutex to static data. Introduce an internal LockStatic class that
locks the mutex while providing a pointer to static data, making that the only
way to access the static data.

The LLINSTANCETRACKER_DTOR_NOEXCEPT macro goes away because we no longer
expect ~LLInstanceTracker() to throw an exception in test programs.
That affects LLTrace::StatBase as well as LLInstanceTracker itself.

Adapt consumers to the new LLInstanceTracker API.
2019-12-02 14:39:24 -05:00
AndreyL ProductEngine e96d0d5e30 Buildfix 2019-11-12 01:59:44 +02:00
AndreyL ProductEngine 84f3b2865f Merged in lindenlab/viewer-release 2019-11-12 00:39:07 +02:00
Nat Goodspeed 7ed993913c Automated merge with ssh://bitbucket.org/lindenlab/viewer-release 2019-11-11 16:45:37 -05:00
Nat Goodspeed 94a50320fb DRTVWR-476: Remove special case for listen(boost::bind(weak_ptr)).
LLEventDetail::visit_and_connect() promised special treatment for the
specific case when an LLEventPump::listen() listener was composed of (possibly
nested) boost::bind() objects storing boost::weak_ptr values -- specifically
boost::bind() rather than std::bind or lambdas, specifically boost::weak_ptr
rather than std::weak_ptr.

Outside of self-tests, it does not appear that anyone actually uses that
support.

There is good reason not to: it's a silent side effect of a complicated
compile-time inspection that could be silently derailed by use of std::bind()
or a lambda or a std::weak_ptr. Can you be sure you've engaged that promise?
How?

A more robust guarantee can be achieved by storing an LLTempBoundConnection in
the transient object itself. When the object is destroyed, the listener is
disconnected. Normal C++ rules around object destruction guarantee it. This
idiom is widely used.

There are a couple good reasons to remove the visit_and_connect() machinery:

* boost::bind() and boost::weak_ptr do not constitute the wave of the future.
  Preferring those constructs to lambdas and std::weak_ptr penalizes new code,
  whether by silently failing or by discouraging use of modern idioms.
* The visit_and_connect() machinery was always complicated, and apparently
  never very robust. Most of its promised features have been commented out
  over the years. Making the code base simpler, clearer and more maintainable
  is always a useful effect.

LLEventDetail::visit_and_connect() was also used by the four
LLNotificationChannelBase::connectMumble() methods. Streamline those as well.

Of course, remove related test code.
2019-10-15 23:06:04 -04:00
andreykproductengine af5c556270 Merge from viewer-release 2019-10-15 21:28:37 +03:00
Nat Goodspeed 279594dcc1 Automated merge with ssh://bitbucket.org/lindenlab/viewer-release 2019-10-15 13:56:39 -04:00
andreykproductengine 37eb735ba7 Merged in lindenlab/viewer-release 2019-09-10 20:30:25 +03:00
Nat Goodspeed 24c7d14199 Automated merge with ssh://bitbucket.org/lindenlab/viewer-release 2019-09-10 11:54:43 -04:00
Nat Goodspeed 1d585c0c40 Automated merge with ssh://bitbucket.org/lindenlab/viewer-release 2019-08-22 20:00:44 -04:00
andreykproductengine be7713cab2 Merged in lindenlab/viewer-release 2019-08-14 15:02:56 +03:00
Nat Goodspeed 98be6e141c DRTVWR-493: Streamline LLParamSingleton, LLLockedSingleton.
Simplify LLSingleton::SingletonLifetimeManager to SingletonInitializer: that
struct has not been responsible for deletion ever since LLSingletonBase
acquired dependency-ordered deleteAll().

Move SingletonData::mInitState changes from SingletonLifetimeManager to
constructSingleton() method. Similarly, constructSingleton() now sets
SingletonData::mInstance instead of making its caller store the pointer.

Add variadic arguments to LLSingleton::constructSingleton() so we can reuse it
for LLParamSingleton.

Add finishInitializing() method to encapsulate logic reused for
getInstance()'s INITIALIZING and DELETED cases.

Make LLParamSingleton a subclass of LLSingleton, just as LLLockedSingleton is
a subclass of LLParamSingleton. Make LLParamSingleton a friend of LLSingleton,
so it can access private members of LLSingleton without also granting access
to any DERIVED_CLASS subclass. This eliminates the need for protected
getInitState().

LLParamSingleton::initParamSingleton() reuses LLSingleton::constructSingleton()
and finishInitializing(). Its getInstance() method completely replaces
LLSingleton::getInstance(): in most EInitStates, LLParamSingleton::getInstance()
is an error.

Use a std::mutex to serialize calls to LLParamSingleton::initParamSingleton()
and getInstance(). While LLSingleton::getInstance() relies on the "initialized
exactly once" guarantee for block-scope static declarations, LLParamSingleton
cannot rely on the same mechanism.

LLLockedSingleton is now a very succinct subclass of LLParamSingleton -- they
have very similar functionality.

Giving the LLSINGLETON() macro variadic arguments eliminates the need for a
separate LLPARAMSINGLETON() macro, while continuing to support existing usage.
2019-08-12 09:44:56 -04:00
andreykproductengine c61d0f4297 DRTVWR-493 LLUI to LLParamSingleton 2019-08-10 15:31:03 +03:00
andreykproductengine 34d8200d0f DRTVWR-493 LLRender2D init cleanup 2019-08-10 09:01:54 +03:00
andreykproductengine b1b102cf66 SL-8380 Ability to disable 2D UI tooltips 2019-07-26 21:10:01 +03:00
andreykproductengine adeee613c6 DRTVWR-493 LLRender2D to LLParamSingleton 2019-07-25 18:20:17 +03:00
maxim_productengine 6b67fd1211 SL-11551 tilia-inc.com as an official Linden Lab URL should have SL icon 2019-07-05 11:44:36 +03:00
andreykproductengine 2752e342f6 DRTVWR-493 LLSpellcheck doesn't need separate init 2019-06-27 22:14:52 +03:00
Anchor 2c2bdcf348 [DRTVWR-476] - fix compiler errors 32 bit windows build 2019-06-10 15:56:44 -07:00
Nat Goodspeed ebcfbf277e Automated merge with ssh://bitbucket.org/lindenlab/viewer-release 2019-06-05 14:15:15 -04:00
andreykproductengine 930bf680c2 SL-10423 Dump path data when missing critical file 2019-06-03 21:37:43 +03:00
Andrey Lihatskiy 91edfab36b Merged in default (pull request #56)
SL-10898[Mac] Camera spins and pulls back when using alt+zoom with mouse

Approved-by: Maxim Nikolenko
Approved-by: Andrey Lihatskiy
2019-05-23 14:34:10 +00:00
ruslantproductengine 6700f2907a SL-10898[Mac] Camera spins and pulls back when using alt+zoom with mouse 2019-05-21 20:09:23 +03:00
ruslantproductengine 0dd7ac4a8d SL-10898[Mac] Camera spins and pulls back when using alt+zoom with mouse 2019-05-21 20:09:23 +03:00
maxim_productengine 401868c440 SL-10898 revert 2019-05-22 15:36:10 +03:00
AndreyL ProductEngine e31f4a352d Mac buildfix 2019-05-14 01:14:54 +03:00
Anchor 4a095782b6 Merge from viewer-fiber 2019-04-18 10:57:14 -07:00
andreykproductengine d1b649055d SL-10890 Ban duration edit field shows value with a left shift if a large value was set 2019-04-05 22:42:04 +03:00
Nat Goodspeed 7e4d6074da DRTVWR-479: Remove unused iterators to pacify Xcode 10.2.
(transplanted from dd8717107c3bac56751ec788873671c6b48dbd81)
2019-03-27 15:51:31 -04:00
AndreyL ProductEngine 59457cfcfe Merged in lindenlab/viewer-release (EAM) 2019-04-17 16:26:45 +03:00
AndreyL ProductEngine 1470e82c89 Merged in lindenlab/viewer-release 2019-04-02 21:51:54 +03:00
AndreyL ProductEngine 5715cda6e0 Merged in lindenlab/viewer-release 2019-03-01 10:55:47 +02:00
AndreyL ProductEngine 36cb6933e6 Merged in lindenlab/viewer-release 2019-03-01 02:24:00 +02:00
andreykproductengine 86d28366b1 SL-1811 Slight chat optimization 2019-02-20 20:30:43 +02:00
andreykproductengine 0c8d51b8c8 SL-10234 Fixed The viewer shows installation language as system default 2019-02-15 20:41:03 +02:00
maxim_productengine 1349eacc5c SL-10325 FIXED Preferences tabs are displayed incorrectly if hovering it while searching any keyword 2019-01-09 17:21:13 +02:00
AndreyL ProductEngine 09b750483a SL-10293 Firestorm PR: preferences and menu search 2019-01-03 22:59:49 +02:00
Nat Goodspeed d2c581c344 Automated merge with ssh://bitbucket.org/lindenlab/viewer-release 2018-12-28 14:46:49 -05:00
Nat Goodspeed f5f504b0f9 DRTVWR-447: Merge up to latest viewer-release 2018-12-16 13:51:15 -05:00
AndreyL ProductEngine 74a56f30aa Merged in lindenlab/viewer-release 2018-12-14 00:46:11 +02:00
maxim_productengine 320b7bacc2 SL-10149 FIXED 'Mute when minimized' checkbox is displayed without focus on it after pressing on label in the "Preferences" floater 2018-12-04 18:51:44 +02:00
andreykproductengine d998325556 SL-10145 Right clicking on unselected link in editor near selected text shows wrong menu 2018-11-30 17:29:54 +02:00
ruslantproductengine acc86a9139 SL-9766 [Render] [Mac] Alt + left mouse click has severely impaired functions
SL-10019 - [Mac] [Render] Right-click context menu immediately disappears when clicking any place in the ‘Inventory’ floater
SL-9984 - [Retina] Camera frustum, do not display correctly on "WORLD MAP" window.
SL-10027 - [Mac] [Render] Add toggle for Retina support to mitigate FPS loss

Re-FIX for Retina support.
2018-11-26 18:02:44 +02:00
ruslantproductengine 755b4a3a6d SL-10019 - [Mac] [Render] Right-click context menu immediately disappears when clicking any place in the ‘Inventory’ floater 2018-11-08 18:33:42 +02:00
ruslantproductengine fc2cdf62f1 SL-9766 [Render] [Mac] Alt + left mouse click has severely impaired functions
FIX #2
2018-11-02 16:27:34 +02:00
Nat Goodspeed 73e70ff0bb DRTVWR-474: Make "LLNotifications" "requestAdd" propagate "reqid"
from request to response to help with request/response matching protocol.
2018-10-04 17:18:08 -04:00
maxim_productengine 228a25256e SL-1397 FIXED Check mark doesn't switch when clicking on the label "Mute when minimized" in Preferences 2018-09-12 17:42:23 +03:00
maxim_productengine cdef4175d4 MAINT-8985 Added missed initialization 2018-08-23 14:53:46 +03:00