summaryrefslogtreecommitdiff
path: root/indra/newview/llselectmgr.h
diff options
context:
space:
mode:
authorNat Goodspeed <nat@lindenlab.com>2017-03-30 15:39:47 -0400
committerNat Goodspeed <nat@lindenlab.com>2017-03-30 15:39:47 -0400
commite9fe0714ad422c2b9250c8ce13d3b2837dff5430 (patch)
tree52617d8e6710fc023e65fcab1ba137da628fe3a8 /indra/newview/llselectmgr.h
parent2d921e00634c593c15776727e513a2d0f9795f21 (diff)
DRTVWR-418: Xcode 8.3 complains about LLSafeHandle<T> implementation.
The previous LLSafeHandle<T> implementation declares a static data member of the template class but provides no (generic) definition, relying on particular specializations to provide the definition. The data member is a function pointer, which is called in one of the methods to produce a pointer to a "null" T instance: that is, a dummy instance to be dereferenced in case the wrapped T* is null. Xcode 8.3's version of clang is bothered by the call, in a generic method, through this (usually) uninitialized pointer. It happens that the only specializations of LLSafeHandle do both provide definitions. I don't know whether that's formally valid C++03 or not; but I agree with the compiler: I don't like it. Instead of declaring a public static function pointer which each specialization is required to define, add a protected static method to the template class. This protected static method simply returns a pointer to a function-static T instance. This is functionally similar to a static LLPointer<T> set on demand (as in the two specializations), including lazy instantiation. Unlike the previous implementation, this approach prohibits a given specialization from customizing the "null" instance function. Although there exist reasonable ways to support that (e.g. a related traits template), I decided not to complicate the LLSafeHandle implementation to make it more generally useful. I don't really approve of LLSafeHandle, and don't want to see it proliferate. It's not clear that unconditionally dereferencing LLSafeHandle<T> is in any way better than conditionally dereferencing LLPointer<T>. It doesn't even skip the runtime conditional test; it simply obscures it. (There exist hints in the code that at one time it might have immediately replaced any wrapped null pointer value with the pointer to the "null" instance, obviating the test at dereference time, but this is not the current functionality. Perhaps it was only ever wishful thinking.) Remove the corresponding functions and static LLPointers from the two classes that use LLSafeHandle.
Diffstat (limited to 'indra/newview/llselectmgr.h')
-rw-r--r--indra/newview/llselectmgr.h1
1 files changed, 1 insertions, 0 deletions
diff --git a/indra/newview/llselectmgr.h b/indra/newview/llselectmgr.h
index 2a893af266..fbf889b2f1 100644
--- a/indra/newview/llselectmgr.h
+++ b/indra/newview/llselectmgr.h
@@ -233,6 +233,7 @@ protected:
class LLObjectSelection : public LLRefCount
{
friend class LLSelectMgr;
+ friend class LLSafeHandle<LLObjectSelection>;
protected:
~LLObjectSelection();