Commit Graph

39757 Commits (310db14beefc29ee72e0d13f0cb63cb2958ebf68)

Author SHA1 Message Date
Nat Goodspeed 310db14bee DRTVWR-493: Improve exception safety of LLSingleton initialization.
Add try/catch clauses to constructSingleton() (to catch exceptions in the
subclass constructor) and finishInitializing() (to catch exceptions in the
subclass initSingleton() method). Each of these catch clauses rethrows the
exception -- they're for cleanup, not for ultimate handling.

Introduce LLSingletonBase::reset_initializing(list_t::size_t). The idea is
that since we can't know whether the exception happened before or after the
push_initializing() call in LLSingletonBase's constructor, we can't just pop
the stack. Instead, constructSingleton() captures the stack size before
attempting to construct the new LLSingleton subclass. On exception, it calls
reset_initializing() to restore the stack to that size.

Naturally that requires a corresponding LLSingleton_manage_master method,
whose MasterList specialization is a no-op.

finishInitializing()'s exception handling is a bit simpler because it has a
constructed LLSingleton subclass instance in hand, therefore
push_initializing() has definitely been called, therefore it can call
pop_initializing().

Break out new static capture_dependency() method from finishInitializing()
because, in the previous LLSingleton::getInstance() implementation, the logic
now wrapped in capture_dependency() was reached even in the INITIALIZED case.
TODO: Add a new EInitState to differentiate "have been constructed, now
calling initSingleton()" from "fully initialized, normal case" -- in the
latter control path we should not be calling capture_dependency().

The LLSingleton_manage_master<LLSingletonBase::MasterList> specialization's
get_initializing() function (which called get_initializing_from()) was
potentially dangerous. get_initializing() is called by push_initializing(),
which (in the general case) is called by LLSingletonBase's constructor. If
somehow the MasterList's LLSingletonBase constructor ended up calling
get_initializing(), it would have called get_initializing_from(), passing an
LLSingletonBase which had not yet been constructed into the MasterList. In
particular, its mInitializing map would not yet have been initialized at all.

Since the MasterList must not, by design, depend on any other LLSingletons,
LLSingleton_manage_master<LLSingletonBase::MasterList>::get_initializing()
need not return a list from the official mInitializing map anyway. It can, and
should, and now does, return a static dummy list. That obviates
get_initializing_from(), which is removed.

That in turn means we no longer need to pass get_initializing() an
LLSingletonBase*. Remove that parameter.
2019-08-19 11:44:56 -04:00
Nat Goodspeed d10b06dc4f DRTVWR-493: When a test fails due to exception, display exception. 2019-08-19 10:00:09 -04:00
Nat Goodspeed 0e6a6c7775 DRTVWR-493: Work around static initialization order problem.
LLParamSingleton contained a static member mutex. Unfortunately that wasn't
guaranteed to be initialized by the time its getInstance() was entered. Use a
function-local static instead.
2019-08-14 13:57:13 -04:00
Nat Goodspeed 63103afb65 No such thing as 'virtual static' 2019-08-14 13:43:08 -04:00
Nat Goodspeed 5196af8663 DRTVWR-493: Rely on recursive_mutex to handle circularity
from LLParamSingleton::initSingleton().
2019-08-12 17:47:48 -04:00
Nat Goodspeed a5f58663c0 Automated merge with ssh://bitbucket.org/andreykproductengine/drtvwr-493 2019-08-12 17:43:09 -04:00
Nat Goodspeed 4fce6dc435 DRTVWR-493: Permit LLParamSingleton::initSingleton() circularity.
This was forbidden, but AndreyK points out cases in which LLParamSingleton::
initSingleton() should in fact be allowed to circle back to its own instance()
method. Use a recursive_mutex instead of plain mutex to permit that; remove
LL_ERRS preventing it.

Add LLParamSingleton::instance() method that calls
LLParamSingleton::getInstance(). Inheriting LLSingleton::instance() called
LLSingleton::getInstance() -- not at all what we want.

Add LLParamSingleton unit tests.
2019-08-12 17:35:45 -04:00
andreykproductengine 3c552696bf DRTVWR-493 LLWearableType to LLParamSingleton 2019-08-12 22:56:15 +03:00
andreykproductengine b6a3901c2f Merge from nat_linden/drtvwr-493 2019-08-12 20:35:27 +03:00
AndreyL ProductEngine d6030c7376 SL-11719 Initialize the conversation dialog on login screen appearance to avoid crash 2019-08-12 19:54:20 +03:00
Nat Goodspeed 5a72d34b76 Automated merge with file:///Users/nat/linden/viewer-catch 2019-08-12 09:58:08 -04: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
Nat Goodspeed f0fa4f94a5 DRTVWR-493: Make catch_llerrs() a member of WrapLLErrs. 2019-08-12 08:26:51 -04:00
Nat Goodspeed 17902bc735 Automated merge with ssh://bitbucket.org/nat_linden/viewer-vs2017 2019-08-12 08:04:30 -04:00
andreykproductengine 1be08814e2 DRTVWR-493 tiny optimization 2019-08-11 12:50:24 +03:00
Nat Goodspeed adb3f447b3 DRTVWR-493: Introduce test catch_what(), catch_llerrs() functions.
Use them in place of awkward try/catch test boilerplate.
2019-08-10 20:33:59 -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
AndreyL ProductEngine c2660070ce SL-11716 Fixed crash on initializing LLUI 2019-08-10 03:09:30 +03:00
andreykproductengine adeee613c6 DRTVWR-493 LLRender2D to LLParamSingleton 2019-07-25 18:20:17 +03:00
andreykproductengine 17fae30f72 DRTVWR-493 LLImage to LLParamSingleton 2019-07-25 15:17:11 +03:00
andreykproductengine 8df0583db0 DRTVWR-493 Cleanup LLSkinningUtil 2019-07-11 16:25:24 +03:00
andreykproductengine 47cbcb61f8 DRTVWR-493 Cleaned up unneded inits. 2019-07-04 20:24:38 +03:00
andreykproductengine 56715de2cf DRTVWR-493 LLUrlWhiteList to LLSingleton 2019-07-04 18:07:46 +03:00
andreykproductengine 779b5627c5 DRTVWR-493 LLAvatarNameCache to singletone 2019-07-03 20:06:47 +03:00
andreykproductengine 2752e342f6 DRTVWR-493 LLSpellcheck doesn't need separate init 2019-06-27 22:14:52 +03:00
andreykproductengine 03f8125405 Backed out changeset: 920a0dbf290a Machine id is needed after singletons die 2019-06-27 18:44:29 +03:00
Nat Goodspeed 8053bceaa0 DRTVWR-476: Pass Obj-C++ switch needed for BugsplatMac on Xcode 10.2. 2019-06-26 15:08:50 -04:00
andreykproductengine fe7232fd2e DRTVWR-493 Cleanup LLFirstUse 2019-06-24 16:15:37 +03:00
andreykproductengine 30cc3ff01f DRTVWR-493 LLViewerParcelMedia to singleton 2019-06-21 21:31:40 +03:00
andreykproductengine 8369276a49 DRTVWR-493 LLViewerMedia to singleton 2019-06-21 20:55:39 +03:00
Nat Goodspeed 6f95100f7e increment viewer version to 6.2.4 2019-06-20 14:18:42 -04:00
Nat Goodspeed 2baff8e016 Added tag 6.2.3-release for changeset ab2ec5c5423b 2019-06-20 14:18:41 -04:00
andreykproductengine a2d91f3160 DRTVWR-493 LLLocalBitmapMgr to Singleton 2019-06-20 20:53:46 +03:00
andreykproductengine 2672093429 DRTVWR-493 LLHint to singleton 2019-06-20 20:03:47 +03:00
andreykproductengine a74ea18116 DRTVWR-493 LLMachineId to singleton 2019-06-19 15:57:03 +03:00
andreykproductengine 55670eef35 DRTVWR-493 LLCallDialogManager to singleton 2019-06-19 17:28:46 +03:00
andreykproductengine acf592419b DRTVWR-493 LLFollowCamMgr to singleton 2019-06-19 16:52:44 +03:00
AndreyL ProductEngine 9212c1f33e SL-11341 Skip storing the previous gamma value on Intel GPUs + more logging 2019-06-04 00:03:03 +03:00
AndreyL ProductEngine b996c95f32 SL-11079 Updated contributions.txt 2019-05-28 23:52:23 +03:00
Drake Arconis 6308743fd2 Fix issue where gamma was being corrupted on windows with night light enabled 2019-02-08 19:26:28 -08:00
Nat Goodspeed 2672194b1d increment viewer version to 6.2.3 2019-05-21 08:57:32 -04:00
Nat Goodspeed 02ab47b256 Added tag 6.2.2-release for changeset ec09daf1899c 2019-05-21 08:57:32 -04:00
Steven Harrison (steven) 771e6344fe Pull from viewer-bear and merge 2019-05-17 16:49:58 +00:00
Steven Harrison (steven) 59c93cb861 SL-11213 No longer embedding the channel in the viewer release note urls. Update base URLs to match new viewer release note URL 2019-05-17 02:23:49 +00:00
AndreyL ProductEngine e31f4a352d Mac buildfix 2019-05-14 01:14:54 +03:00
Nat Goodspeed 34322f8f37 increment viewer version to 6.2.2 2019-05-07 15:24:01 -04:00
Nat Goodspeed 031ebc8d6d Added tag 6.2.1-release for changeset 706bdc7e25c6 2019-05-07 15:24:00 -04:00
Graham Linden 81c39d28fe Fix spurious assert from using highlights without binding highlight shader.
Only affects devs, but could have downstream consequences for rendering.
2019-04-30 14:25:48 -07:00
AndreyL ProductEngine 5e5c5ca09c Merged SL-10400 and SL-10401 2019-04-26 21:02:00 +03:00