Merge Firestorm LGPL

Tue, 08 May 2018 18:31:13 +0200

author
Ansariel
date
Tue, 08 May 2018 18:31:13 +0200
changeset 55375
87396b7b96ca
parent 55374
dba925f5b176
parent 55183
24c3d4e46d40
child 55376
d1e62eb8b2ac

Merge Firestorm LGPL

autobuild.xml file | annotate | diff | revisions
indra/llcommon/llmemory.cpp file | annotate | diff | revisions
indra/llcommon/llthread.cpp file | annotate | diff | revisions
indra/llcommon/nd/ndboolswitch.h file | annotate | diff | revisions
indra/llcommon/nd/ndintrin.cpp file | annotate | diff | revisions
indra/llcommon/nd/ndintrin.h file | annotate | diff | revisions
indra/llcommon/nd/ndlocks.h file | annotate | diff | revisions
indra/llcommon/nd/ndobjectpool.h file | annotate | diff | revisions
indra/llcommon/nd/ndstlallocator.h file | annotate | diff | revisions
indra/llimage/llimage.cpp file | annotate | diff | revisions
indra/llprimitive/llmodel.cpp file | annotate | diff | revisions
indra/llvfs/llvfs.cpp file | annotate | diff | revisions
indra/media_plugins/cef/media_plugin_cef.cpp file | annotate | diff | revisions
indra/newview/app_settings/settings.xml file | annotate | diff | revisions
indra/newview/llappviewer.cpp file | annotate | diff | revisions
indra/newview/llmeshrepository.cpp file | annotate | diff | revisions
indra/newview/lloutfitslist.cpp file | annotate | diff | revisions
indra/newview/llpanelwearing.cpp file | annotate | diff | revisions
indra/newview/llpanelwearing.h file | annotate | diff | revisions
indra/newview/lltexturecache.cpp file | annotate | diff | revisions
indra/newview/lltexturefetch.cpp file | annotate | diff | revisions
indra/newview/llviewermediafocus.cpp file | annotate | diff | revisions
indra/newview/llviewermenu.cpp file | annotate | diff | revisions
indra/newview/llviewerobject.cpp file | annotate | diff | revisions
indra/newview/llviewerwindow.cpp file | annotate | diff | revisions
indra/newview/llvoavatar.cpp file | annotate | diff | revisions
indra/newview/llvovolume.cpp file | annotate | diff | revisions
indra/newview/pipeline.cpp file | annotate | diff | revisions
indra/newview/viewer_manifest.py file | annotate | diff | revisions
     1.1 --- a/autobuild.xml	Tue May 01 16:45:50 2018 +0200
     1.2 +++ b/autobuild.xml	Tue May 08 18:31:13 2018 +0200
     1.3 @@ -42,9 +42,9 @@
     1.4              <key>archive</key>
     1.5              <map>
     1.6                <key>hash</key>
     1.7 -              <string>2709f7a5cf499ea77481dd1fce796d61</string>
     1.8 -              <key>url</key>
     1.9 -              <string>http://downloads.phoenixviewer.com/ndPhysicsStub-1.201505150224-r74-linux-x64-201505150224-r74.tar.bz2</string>
    1.10 +              <string>99fe10fdec03a22d680de72bc8b5f85a</string>
    1.11 +              <key>url</key>
    1.12 +              <string>http://downloads.phoenixviewer.com/ndPhysicsStub-1.181041840-linux64-181041840.tar.bz2</string>
    1.13              </map>
    1.14              <key>name</key>
    1.15              <string>linux64</string>
    1.16 @@ -660,9 +660,9 @@
    1.17              <key>archive</key>
    1.18              <map>
    1.19                <key>hash</key>
    1.20 -              <string>2fa9e9e89a81ed2ed686a170681f6bbc</string>
    1.21 -              <key>url</key>
    1.22 -              <string>http://automated-builds-secondlife-com.s3.amazonaws.com/ct2/571/1225/dictionaries-1.500564-common-500564.tar.bz2</string>
    1.23 +              <string>2d59bb6f4bd38a18d9250ff010a13b59</string>
    1.24 +              <key>url</key>
    1.25 +              <string>http://downloads.phoenixviewer.com/dictionaries-2.46203-common-46203.tar.bz2</string>
    1.26              </map>
    1.27              <key>name</key>
    1.28              <string>common</string>
    1.29 @@ -714,9 +714,9 @@
    1.30              <key>archive</key>
    1.31              <map>
    1.32                <key>hash</key>
    1.33 -              <string>6dded97d697c5ac9e4bd33c9ca8e3f9e</string>
    1.34 -              <key>url</key>
    1.35 -              <string>http://downloads.phoenixviewer.com/dullahan-1.1.1080_3.3325.1750.gaabe4c4-linux64-180861548.tar.bz2</string>
    1.36 +              <string>c01b1a180f6c12d00d359996ecd1cf52</string>
    1.37 +              <key>url</key>
    1.38 +              <string>http://downloads.phoenixviewer.com/dullahan-1.1.1080_3.3325.1750.gaabe4c4-linux64-181051505.tar.bz2</string>
    1.39              </map>
    1.40              <key>name</key>
    1.41              <string>linux64</string>
    1.42 @@ -1276,11 +1276,11 @@
    1.43              <key>archive</key>
    1.44              <map>
    1.45                <key>hash</key>
    1.46 -              <string>4aa53f9774195899efb9d14a0f6c4748</string>
    1.47 +              <string>3bae1e9a188680a81c1d5b32571538b9</string>
    1.48                <key>hash_algorithm</key>
    1.49                <string>md5</string>
    1.50                <key>url</key>
    1.51 -              <string>http://downloads.phoenixviewer.com/glod-1.0pre3.180872225-linux-180872225.tar.bz2</string>
    1.52 +              <string>http://downloads.phoenixviewer.com/glod-1.0pre3.180990859-linux-180990859.tar.bz2</string>
    1.53              </map>
    1.54              <key>name</key>
    1.55              <string>linux</string>
    1.56 @@ -1290,9 +1290,9 @@
    1.57              <key>archive</key>
    1.58              <map>
    1.59                <key>hash</key>
    1.60 -              <string>c742c8b3903aadd79c3a6f3d3c09986d</string>
    1.61 -              <key>url</key>
    1.62 -              <string>http://downloads.phoenixviewer.com/glod-1.0pre3.180842253-linux64-180842253.tar.bz2</string>
    1.63 +              <string>acc1181cd31ef32c3724eda84ae4b580</string>
    1.64 +              <key>url</key>
    1.65 +              <string>http://downloads.phoenixviewer.com/glod-1.0pre3.180990827-linux64-180990827.tar.bz2</string>
    1.66              </map>
    1.67              <key>name</key>
    1.68              <string>linux64</string>
    1.69 @@ -1852,9 +1852,9 @@
    1.70              <key>archive</key>
    1.71              <map>
    1.72                <key>hash</key>
    1.73 -              <string>724850830e01cdb6afb4eed9ce2ec6c5</string>
    1.74 -              <key>url</key>
    1.75 -              <string>http://downloads.phoenixviewer.com/jsoncpp-0.5.0.180841554-linux64-180841554.tar.bz2</string>
    1.76 +              <string>275d45727849245f2ed147d60b905413</string>
    1.77 +              <key>url</key>
    1.78 +              <string>http://downloads.phoenixviewer.com/jsoncpp-0.5.0.181041824-linux64-181041824.tar.bz2</string>
    1.79              </map>
    1.80              <key>name</key>
    1.81              <string>linux64</string>
    1.82 @@ -2964,9 +2964,9 @@
    1.83              <key>archive</key>
    1.84              <map>
    1.85                <key>hash</key>
    1.86 -              <string>cc1aca5688b00878ae94a0ad71cb4f35</string>
    1.87 -              <key>url</key>
    1.88 -              <string>http://downloads.phoenixviewer.com/openjpeg-1.5.1.180871249-linux-180871249.tar.bz2</string>
    1.89 +              <string>4a5591349005afac44a688e99517a9f3</string>
    1.90 +              <key>url</key>
    1.91 +              <string>http://downloads.phoenixviewer.com/openjpeg-1.5.1.180991818-linux-180991818.tar.bz2</string>
    1.92              </map>
    1.93              <key>name</key>
    1.94              <string>linux</string>
    1.95 @@ -2976,9 +2976,9 @@
    1.96              <key>archive</key>
    1.97              <map>
    1.98                <key>hash</key>
    1.99 -              <string>6098e555296583336b02f1a78b41b93a</string>
   1.100 -              <key>url</key>
   1.101 -              <string>http://downloads.phoenixviewer.com/openjpeg-1.5.1.180841553-linux64-180841553.tar.bz2</string>
   1.102 +              <string>addb209bb56a8f16602a7222f119191d</string>
   1.103 +              <key>url</key>
   1.104 +              <string>http://downloads.phoenixviewer.com/openjpeg-1.5.1.180991822-linux64-180991822.tar.bz2</string>
   1.105              </map>
   1.106              <key>name</key>
   1.107              <string>linux64</string>
   1.108 @@ -3280,9 +3280,9 @@
   1.109              <key>archive</key>
   1.110              <map>
   1.111                <key>hash</key>
   1.112 -              <string>785c86999b56e1838cefb430f674cba7</string>
   1.113 -              <key>url</key>
   1.114 -              <string>http://automated-builds-secondlife-com.s3.amazonaws.com/hg/repo/oz-426-slvoice/rev/330003/arch/Linux/installer/slvoice-3.2.0002.10426.330003-linux-330003.tar.bz2</string>
   1.115 +              <string>6e7b0961d6489a1b3c3090eccfd6e80e</string>
   1.116 +              <key>url</key>
   1.117 +              <string>http://downloads.phoenixviewer.com/slvoice-3.2.0002.10426.298329-linux-20160717.tar.bz2</string>
   1.118              </map>
   1.119              <key>name</key>
   1.120              <string>linux</string>
   1.121 @@ -3292,9 +3292,9 @@
   1.122              <key>archive</key>
   1.123              <map>
   1.124                <key>hash</key>
   1.125 -              <string>92b0ae08832bd0e99c34ef8f3e6346ad</string>
   1.126 -              <key>url</key>
   1.127 -              <string>http://automated-builds-secondlife-com.s3.amazonaws.com/ct2/613/1289/slvoice-3.2.0002.10426.500605-linux64-500605.tar.bz2</string>
   1.128 +              <string>6e7b0961d6489a1b3c3090eccfd6e80e</string>
   1.129 +              <key>url</key>
   1.130 +              <string>http://downloads.phoenixviewer.com/slvoice-3.2.0002.10426.298329-linux-20160717.tar.bz2</string>
   1.131              </map>
   1.132              <key>name</key>
   1.133              <string>linux64</string>
     2.1 --- a/indra/cmake/Copy3rdPartyLibs.cmake	Tue May 01 16:45:50 2018 +0200
     2.2 +++ b/indra/cmake/Copy3rdPartyLibs.cmake	Tue May 08 18:31:13 2018 +0200
     2.3 @@ -239,7 +239,7 @@
     2.4          ${EXPAT_COPY}
     2.5          #libfreetype.so.6.6.2
     2.6          #libfreetype.so.6
     2.7 -        libGLOD.so
     2.8 +        #libGLOD.so
     2.9          libgmodule-2.0.so
    2.10          libgobject-2.0.so
    2.11          libhunspell-1.3.so.0.0.0
     3.1 --- a/indra/cmake/GLOD.cmake	Tue May 01 16:45:50 2018 +0200
     3.2 +++ b/indra/cmake/GLOD.cmake	Tue May 08 18:31:13 2018 +0200
     3.3 @@ -7,5 +7,9 @@
     3.4    include(Prebuilt)
     3.5    use_prebuilt_binary(glod)
     3.6  set(GLOD_INCLUDE_DIR ${LIBS_PREBUILT_DIR}/include)
     3.7 -set(GLOD_LIBRARIES GLOD)
     3.8 +if(LINUX)
     3.9 +  set(GLOD_LIBRARIES GLOD vds)
    3.10 +else()
    3.11 +  set(GLOD_LIBRARIES GLOD)
    3.12 +endif()
    3.13  #endif (USESYSTEMLIBS)
     4.1 --- a/indra/llcommon/CMakeLists.txt	Tue May 01 16:45:50 2018 +0200
     4.2 +++ b/indra/llcommon/CMakeLists.txt	Tue May 08 18:31:13 2018 +0200
     4.3 @@ -256,18 +256,12 @@
     4.4  
     4.5  SET( llcommon_ND_SOURCE_FILES
     4.6  	 nd/ndexceptions.cpp
     4.7 -	 nd/ndintrin.cpp
     4.8  	 nd/ndlogthrottle.cpp
     4.9  	 nd/ndetw.cpp
    4.10  	 )
    4.11  SET(  llcommon_ND_HEADER_FILES 
    4.12 -	  nd/ndboolswitch.h
    4.13  	  nd/ndexceptions.h
    4.14 -	  nd/ndintrin.h
    4.15 -	  nd/ndlocks.h
    4.16  	  nd/ndlogthrottle.h
    4.17 -	  nd/ndobjectpool.h
    4.18 -	  nd/ndstlallocator.h
    4.19  	  nd/ndetw.h
    4.20  	  )
    4.21  
     5.1 --- a/indra/llcommon/llapp.h	Tue May 01 16:45:50 2018 +0200
     5.2 +++ b/indra/llcommon/llapp.h	Tue May 08 18:31:13 2018 +0200
     5.3 @@ -30,9 +30,9 @@
     5.4  #include <map>
     5.5  #include "llrun.h"
     5.6  #include "llsd.h"
     5.7 +#include <atomic>
     5.8  // Forward declarations
     5.9 -template <typename Type> class LLAtomic32;
    5.10 -typedef LLAtomic32<U32> LLAtomicU32;
    5.11 +
    5.12  class LLErrorThread;
    5.13  class LLLiveFile;
    5.14  #if LL_LINUX
     6.1 --- a/indra/llcommon/llapr.cpp	Tue May 01 16:45:50 2018 +0200
     6.2 +++ b/indra/llcommon/llapr.cpp	Tue May 08 18:31:13 2018 +0200
     6.3 @@ -33,8 +33,6 @@
     6.4  
     6.5  apr_pool_t *gAPRPoolp = NULL; // Global APR memory pool
     6.6  LLVolatileAPRPool *LLAPRFile::sAPRFilePoolp = NULL ; //global volatile APR memory pool.
     6.7 -apr_thread_mutex_t *gLogMutexp = NULL;
     6.8 -apr_thread_mutex_t *gCallStacksLogMutexp = NULL;
     6.9  
    6.10  const S32 FULL_VOLATILE_APR_POOL = 1024 ; //number of references to LLVolatileAPRPool
    6.11  
    6.12 @@ -46,18 +44,10 @@
    6.13  	apr_initialize();
    6.14  	
    6.15  	if (!gAPRPoolp)
    6.16 -	{
    6.17  		apr_pool_create(&gAPRPoolp, NULL);
    6.18 -		
    6.19 -		// Initialize the logging mutex
    6.20 -		apr_thread_mutex_create(&gLogMutexp, APR_THREAD_MUTEX_UNNESTED, gAPRPoolp);
    6.21 -		apr_thread_mutex_create(&gCallStacksLogMutexp, APR_THREAD_MUTEX_UNNESTED, gAPRPoolp);
    6.22 -	}
    6.23  
    6.24  	if(!LLAPRFile::sAPRFilePoolp)
    6.25 -	{
    6.26  		LLAPRFile::sAPRFilePoolp = new LLVolatileAPRPool(FALSE) ;
    6.27 -	}
    6.28  
    6.29  	LLThreadLocalPointerBase::initAllThreadLocalStorage();
    6.30  	gAPRInitialized = true;
    6.31 @@ -75,22 +65,8 @@
    6.32  
    6.33  	LL_INFOS("APR") << "Cleaning up APR" << LL_ENDL;
    6.34  
    6.35 -	if (gLogMutexp)
    6.36 -	{
    6.37 -		// Clean up the logging mutex
    6.38 -
    6.39 -		// All other threads NEED to be done before we clean up APR, so this is okay.
    6.40 -		apr_thread_mutex_destroy(gLogMutexp);
    6.41 -		gLogMutexp = NULL;
    6.42 -	}
    6.43 -	if (gCallStacksLogMutexp)
    6.44 -	{
    6.45 -		// Clean up the logging mutex
    6.46 -
    6.47 -		// All other threads NEED to be done before we clean up APR, so this is okay.
    6.48 -		apr_thread_mutex_destroy(gCallStacksLogMutexp);
    6.49 -		gCallStacksLogMutexp = NULL;
    6.50 -	}
    6.51 +	// Clean up the logging mutex
    6.52 +	// All other threads NEED to be done before we clean up APR, so this is okay.
    6.53  
    6.54  	LLThreadLocalPointerBase::destroyAllThreadLocalStorage();
    6.55  
    6.56 @@ -186,18 +162,14 @@
    6.57  
    6.58  	{
    6.59  		apr_pool_create(&mMutexPool, NULL); // Create a pool for mutex
    6.60 -		apr_thread_mutex_create(&mMutexp, APR_THREAD_MUTEX_UNNESTED, mMutexPool);
    6.61 +		mMutexp = new std::mutex();
    6.62  	}
    6.63  }
    6.64  
    6.65  LLVolatileAPRPool::~LLVolatileAPRPool()
    6.66  {
    6.67 -	//delete mutex
    6.68 -	if(mMutexp)
    6.69 -	{
    6.70 -		apr_thread_mutex_destroy(mMutexp);
    6.71 -		apr_pool_destroy(mMutexPool);
    6.72 -	}
    6.73 +	delete mMutexp;
    6.74 +	mMutexp = nullptr;
    6.75  }
    6.76  
    6.77  //
    6.78 @@ -264,18 +236,12 @@
    6.79  //
    6.80  // LLScopedLock
    6.81  //
    6.82 -LLScopedLock::LLScopedLock(apr_thread_mutex_t* mutex) : mMutex(mutex)
    6.83 +LLScopedLock::LLScopedLock(std::mutex* mutex) : mMutex(mutex)
    6.84  {
    6.85  	if(mutex)
    6.86  	{
    6.87 -		if(ll_apr_warn_status(apr_thread_mutex_lock(mMutex)))
    6.88 -		{
    6.89 -			mLocked = false;
    6.90 -		}
    6.91 -		else
    6.92 -		{
    6.93 -			mLocked = true;
    6.94 -		}
    6.95 +		mutex->lock();
    6.96 +		mLocked = true;
    6.97  	}
    6.98  	else
    6.99  	{
   6.100 @@ -292,10 +258,7 @@
   6.101  {
   6.102  	if(mLocked)
   6.103  	{
   6.104 -		if(!ll_apr_warn_status(apr_thread_mutex_unlock(mMutex)))
   6.105 -		{
   6.106 -			mLocked = false;
   6.107 -		}
   6.108 +		mMutex->unlock();
   6.109  	}
   6.110  }
   6.111  
     7.1 --- a/indra/llcommon/llapr.h	Tue May 01 16:45:50 2018 +0200
     7.2 +++ b/indra/llcommon/llapr.h	Tue May 08 18:31:13 2018 +0200
     7.3 @@ -36,16 +36,23 @@
     7.4  #include <boost/noncopyable.hpp>
     7.5  #include "llwin32headerslean.h"
     7.6  #include "apr_thread_proc.h"
     7.7 -#include "apr_thread_mutex.h"
     7.8 +
     7.9  #include "apr_getopt.h"
    7.10  #include "apr_signal.h"
    7.11 -#include "apr_atomic.h"
    7.12 +#include <atomic>
    7.13 +
    7.14 +#if LL_WINDOWS
    7.15 +#pragma warning(disable:4265)
    7.16 +#endif
    7.17 +
    7.18 +#include <mutex>
    7.19 +
    7.20 +#if LL_WINDOWS
    7.21 +#pragma warning(default:4265)
    7.22 +#endif
    7.23  
    7.24  #include "llstring.h"
    7.25  
    7.26 -extern LL_COMMON_API apr_thread_mutex_t* gLogMutexp;
    7.27 -extern apr_thread_mutex_t* gCallStacksLogMutexp;
    7.28 -
    7.29  struct apr_dso_handle_t;
    7.30  /**
    7.31   * @brief Function which appropriately logs error or remains quiet on
    7.32 @@ -120,7 +127,7 @@
    7.33  	S32 mNumActiveRef ; //number of active pointers pointing to the apr_pool.
    7.34  	S32 mNumTotalRef ;  //number of total pointers pointing to the apr_pool since last creating.  
    7.35  
    7.36 -	apr_thread_mutex_t *mMutexp;
    7.37 +	std::mutex *mMutexp;
    7.38  	apr_pool_t         *mMutexPool;
    7.39  } ;
    7.40  
    7.41 @@ -142,7 +149,7 @@
    7.42  	 * @param mutex An allocated APR mutex. If you pass in NULL,
    7.43  	 * this wrapper will not lock.
    7.44  	 */
    7.45 -	LLScopedLock(apr_thread_mutex_t* mutex);
    7.46 +	LLScopedLock( std::mutex* mutex );
    7.47  
    7.48  	/**
    7.49  	 * @brief Destructor which unlocks the mutex if still locked.
    7.50 @@ -161,35 +168,43 @@
    7.51  
    7.52  protected:
    7.53  	bool mLocked;
    7.54 -	apr_thread_mutex_t* mMutex;
    7.55 +	std::mutex* mMutex;
    7.56  };
    7.57  
    7.58 -template <typename Type> class LLAtomic32
    7.59 +template <typename Type, typename AtomicType = std::atomic< Type > > class LLAtomicBase
    7.60  {
    7.61  public:
    7.62 -	LLAtomic32<Type>() {};
    7.63 -	LLAtomic32<Type>(Type x) {apr_atomic_set32(&mData, apr_uint32_t(x)); };
    7.64 -	~LLAtomic32<Type>() {};
    7.65 +	LLAtomicBase() {};
    7.66 +	LLAtomicBase( Type x ) { mData.store( x ); };
    7.67 +	~LLAtomicBase() {};
    7.68  
    7.69 -	operator const Type() { apr_uint32_t data = apr_atomic_read32(&mData); return Type(data); }
    7.70 +	operator const Type() { return mData; }
    7.71  	
    7.72 -	Type	CurrentValue() const { apr_uint32_t data = apr_atomic_read32(const_cast< volatile apr_uint32_t* >(&mData)); return Type(data); }
    7.73 +	Type	CurrentValue() const { return mData; }
    7.74  
    7.75 -	Type operator =(const Type& x) { apr_atomic_set32(&mData, apr_uint32_t(x)); return Type(mData); }
    7.76 -	void operator -=(Type x) { apr_atomic_sub32(&mData, apr_uint32_t(x)); }
    7.77 -	void operator +=(Type x) { apr_atomic_add32(&mData, apr_uint32_t(x)); }
    7.78 -	Type operator ++(int) { return apr_atomic_inc32(&mData); } // Type++
    7.79 -	Type operator --(int) { return apr_atomic_dec32(&mData); } // approximately --Type (0 if final is 0, non-zero otherwise)
    7.80 +	Type operator =( Type x) { mData.store( x ); return mData; }
    7.81 +	void operator -=(Type x) { mData -= x; }
    7.82 +	void operator +=(Type x) { mData += x; }
    7.83 +	Type operator ++(int) { return mData++; }
    7.84 +	Type operator --(int) { return mData--; }
    7.85  
    7.86 -	Type operator ++() { return apr_atomic_inc32(&mData); } // Type++
    7.87 -	Type operator --() { return apr_atomic_dec32(&mData); } // approximately --Type (0 if final is 0, non-zero otherwise)
    7.88 +	Type operator ++() { return ++mData; }
    7.89 +	Type operator --() { return --mData; }
    7.90  	
    7.91  private:
    7.92 -	volatile apr_uint32_t mData;
    7.93 +	AtomicType mData;
    7.94  };
    7.95  
    7.96 -typedef LLAtomic32<U32> LLAtomicU32;
    7.97 -typedef LLAtomic32<S32> LLAtomicS32;
    7.98 +// ND: Typedefs for specialized versions. Using std::atomic_(u)int32_t to get the optimzed implementation.
    7.99 +#ifdef LL_WINDOWS
   7.100 +typedef LLAtomicBase<U32, std::atomic_uint32_t> LLAtomicU32;
   7.101 +typedef LLAtomicBase<S32, std::atomic_int32_t> LLAtomicS32;
   7.102 +#else
   7.103 +typedef LLAtomicBase<U32, std::atomic_uint> LLAtomicU32;
   7.104 +typedef LLAtomicBase<S32, std::atomic_int> LLAtomicS32;
   7.105 +#endif
   7.106 +
   7.107 +typedef LLAtomicBase<bool, std::atomic_bool> LLAtomicBool;
   7.108  
   7.109  // File IO convenience functions.
   7.110  // Returns NULL if the file fails to open, sets *sizep to file size if not NULL
     8.1 --- a/indra/llcommon/llerror.cpp	Tue May 01 16:45:50 2018 +0200
     8.2 +++ b/indra/llcommon/llerror.cpp	Tue May 08 18:31:13 2018 +0200
     8.3 @@ -54,6 +54,9 @@
     8.4  #include "nd/ndlogthrottle.h"
     8.5  
     8.6  namespace {
     8.7 +	LLMutex gLogMutex;
     8.8 +	LLMutex gCallStacksLogMutex ;
     8.9 +
    8.10  #if LL_WINDOWS
    8.11  	void debugger_print(const std::string& s)
    8.12  	{
    8.13 @@ -417,7 +420,7 @@
    8.14  
    8.15  namespace LLError
    8.16  {
    8.17 -	class SettingsConfig : public LLRefCount
    8.18 +	class SettingsConfig: public LLRefCount
    8.19  	{
    8.20  		friend class Settings;
    8.21  
    8.22 @@ -1035,64 +1038,14 @@
    8.23  		}
    8.24  		return found_level;
    8.25  	}
    8.26 -	
    8.27 -	class LogLock
    8.28 -	{
    8.29 -	public:
    8.30 -		LogLock();
    8.31 -		~LogLock();
    8.32 -		bool ok() const { return mOK; }
    8.33 -	private:
    8.34 -		bool mLocked;
    8.35 -		bool mOK;
    8.36 -	};
    8.37 -	
    8.38 -	LogLock::LogLock()
    8.39 -		: mLocked(false), mOK(false)
    8.40 -	{
    8.41 -		if (!gLogMutexp)
    8.42 -		{
    8.43 -			mOK = true;
    8.44 -			return;
    8.45 -		}
    8.46 -		
    8.47 -		const int MAX_RETRIES = 5;
    8.48 -		for (int attempts = 0; attempts < MAX_RETRIES; ++attempts)
    8.49 -		{
    8.50 -			apr_status_t s = apr_thread_mutex_trylock(gLogMutexp);
    8.51 -			if (!APR_STATUS_IS_EBUSY(s))
    8.52 -			{
    8.53 -				mLocked = true;
    8.54 -				mOK = true;
    8.55 -				return;
    8.56 -			}
    8.57 -
    8.58 -			ms_sleep(1);
    8.59 -			//apr_thread_yield();
    8.60 -				// Just yielding won't necessarily work, I had problems with
    8.61 -				// this on Linux - doug 12/02/04
    8.62 -		}
    8.63 -
    8.64 -		// We're hosed, we can't get the mutex.  Blah.
    8.65 -		std::cerr << "LogLock::LogLock: failed to get mutex for log"
    8.66 -					<< std::endl;
    8.67 -	}
    8.68 -	
    8.69 -	LogLock::~LogLock()
    8.70 -	{
    8.71 -		if (mLocked)
    8.72 -		{
    8.73 -			apr_thread_mutex_unlock(gLogMutexp);
    8.74 -		}
    8.75 -	}
    8.76  }
    8.77  
    8.78  namespace LLError
    8.79  {
    8.80  	bool Log::shouldLog(CallSite& site)
    8.81  	{
    8.82 -		LogLock lock;
    8.83 -		if (!lock.ok())
    8.84 +		LLMutexTrylock lock( &gLogMutex,5);
    8.85 +		if (!lock.isLocked() )
    8.86  		{
    8.87  			return false;
    8.88  		}
    8.89 @@ -1142,11 +1095,11 @@
    8.90  
    8.91  	std::ostringstream* Log::out()
    8.92  	{
    8.93 -		LogLock lock;
    8.94 +		LLMutexTrylock lock(&gLogMutex,5);
    8.95  		// If we hit a logging request very late during shutdown processing,
    8.96  		// when either of the relevant LLSingletons has already been deleted,
    8.97  		// DO NOT resurrect them.
    8.98 -		if (lock.ok() && ! (Settings::wasDeleted() || Globals::wasDeleted()))
    8.99 +		if (lock.isLocked() && ! (Settings::wasDeleted() || Globals::wasDeleted()))
   8.100  		{
   8.101  			Globals* g = Globals::getInstance();
   8.102  
   8.103 @@ -1162,8 +1115,8 @@
   8.104  
   8.105  	void Log::flush(std::ostringstream* out, char* message)
   8.106  	{
   8.107 -		LogLock lock;
   8.108 -		if (!lock.ok())
   8.109 +		LLMutexTrylock lock(&gLogMutex,5);
   8.110 +		if (!lock.isLocked())
   8.111  		{
   8.112  			return;
   8.113  		}
   8.114 @@ -1202,8 +1155,8 @@
   8.115  
   8.116  	void Log::flush(std::ostringstream* out, const CallSite& site)
   8.117  	{
   8.118 -		LogLock lock;
   8.119 -		if (!lock.ok())
   8.120 +		LLMutexTrylock lock(&gLogMutex,5);
   8.121 +		if (!lock.isLocked())
   8.122  		{
   8.123  			return;
   8.124  		}
     9.1 --- a/indra/llcommon/llfixedbuffer.cpp	Tue May 01 16:45:50 2018 +0200
     9.2 +++ b/indra/llcommon/llfixedbuffer.cpp	Tue May 08 18:31:13 2018 +0200
     9.3 @@ -30,8 +30,7 @@
     9.4  
     9.5  LLFixedBuffer::LLFixedBuffer(const U32 max_lines)
     9.6  	: LLLineBuffer(),
     9.7 -	  mMaxLines(max_lines),
     9.8 -	  mMutex(NULL)
     9.9 +	  mMaxLines(max_lines)
    9.10  {
    9.11  	mTimer.reset();
    9.12  }
    10.1 --- a/indra/llcommon/llinstancetracker.cpp	Tue May 01 16:45:50 2018 +0200
    10.2 +++ b/indra/llcommon/llinstancetracker.cpp	Tue May 08 18:31:13 2018 +0200
    10.3 @@ -36,17 +36,16 @@
    10.4  
    10.5  void LLInstanceTrackerBase::StaticBase::incrementDepth()
    10.6  {
    10.7 -	apr_atomic_inc32(&sIterationNestDepth);
    10.8 +	++sIterationNestDepth;
    10.9  }
   10.10  
   10.11  void LLInstanceTrackerBase::StaticBase::decrementDepth()
   10.12  {
   10.13  	llassert(sIterationNestDepth);
   10.14 -	apr_atomic_dec32(&sIterationNestDepth);
   10.15 +	--sIterationNestDepth;
   10.16  }
   10.17  
   10.18  U32 LLInstanceTrackerBase::StaticBase::getDepth()
   10.19  {
   10.20 -	apr_uint32_t data = apr_atomic_read32(&sIterationNestDepth);
   10.21 -	return data;
   10.22 +	return sIterationNestDepth;
   10.23  }
    11.1 --- a/indra/llcommon/llinstancetracker.h	Tue May 01 16:45:50 2018 +0200
    11.2 +++ b/indra/llcommon/llinstancetracker.h	Tue May 08 18:31:13 2018 +0200
    11.3 @@ -31,6 +31,7 @@
    11.4  #include <map>
    11.5  #include <typeinfo>
    11.6  
    11.7 +#include <atomic>
    11.8  #include "llstringtable.h"
    11.9  #include <boost/iterator/transform_iterator.hpp>
   11.10  #include <boost/iterator/indirect_iterator.hpp>
   11.11 @@ -119,7 +120,11 @@
   11.12  		void decrementDepth();
   11.13  		U32 getDepth();
   11.14  	private:
   11.15 -		U32 sIterationNestDepth;
   11.16 +	#ifdef LL_WINDOWS
   11.17 +		std::atomic_uint32_t sIterationNestDepth;
   11.18 +	#else
   11.19 +		std::atomic_uint sIterationNestDepth;
   11.20 +	#endif
   11.21      };
   11.22  };
   11.23  
    12.1 --- a/indra/llcommon/llmutex.cpp	Tue May 01 16:45:50 2018 +0200
    12.2 +++ b/indra/llcommon/llmutex.cpp	Tue May 08 18:31:13 2018 +0200
    12.3 @@ -33,20 +33,9 @@
    12.4  
    12.5  //============================================================================
    12.6  
    12.7 -LLMutex::LLMutex(apr_pool_t *poolp) :
    12.8 -	mAPRMutexp(NULL), mCount(0), mLockingThread(NO_THREAD)
    12.9 +LLMutex::LLMutex() :
   12.10 + mCount(0), mLockingThread(NO_THREAD)
   12.11  {
   12.12 -	//if (poolp)
   12.13 -	//{
   12.14 -	//	mIsLocalPool = FALSE;
   12.15 -	//	mAPRPoolp = poolp;
   12.16 -	//}
   12.17 -	//else
   12.18 -	{
   12.19 -		mIsLocalPool = TRUE;
   12.20 -		apr_pool_create(&mAPRPoolp, NULL); // Create a subpool for this thread
   12.21 -	}
   12.22 -	apr_thread_mutex_create(&mAPRMutexp, APR_THREAD_MUTEX_UNNESTED, mAPRPoolp);
   12.23  }
   12.24  
   12.25  
   12.26 @@ -56,15 +45,6 @@
   12.27  	//bad assertion, the subclass LLSignal might be "locked", and that's OK
   12.28  	//llassert_always(!isLocked()); // better not be locked!
   12.29  #endif
   12.30 -	if (ll_apr_is_initialized())
   12.31 -	{
   12.32 -		apr_thread_mutex_destroy(mAPRMutexp);
   12.33 -		if (mIsLocalPool)
   12.34 -		{
   12.35 -			apr_pool_destroy(mAPRPoolp);
   12.36 -		}
   12.37 -	}
   12.38 -	mAPRMutexp = NULL;
   12.39  }
   12.40  
   12.41  
   12.42 @@ -76,7 +56,7 @@
   12.43  		return;
   12.44  	}
   12.45  	
   12.46 -	apr_thread_mutex_lock(mAPRMutexp);
   12.47 +	mMutex.lock();
   12.48  	
   12.49  #if MUTEX_DEBUG
   12.50  	// Have to have the lock before we can access the debug info
   12.51 @@ -106,19 +86,16 @@
   12.52  #endif
   12.53  
   12.54  	mLockingThread = NO_THREAD;
   12.55 -	apr_thread_mutex_unlock(mAPRMutexp);
   12.56 +	mMutex.unlock();
   12.57  }
   12.58  
   12.59  bool LLMutex::isLocked()
   12.60  {
   12.61 -	apr_status_t status = apr_thread_mutex_trylock(mAPRMutexp);
   12.62 -	if (APR_STATUS_IS_EBUSY(status))
   12.63 -	{
   12.64 +	if (!mMutex.try_lock())
   12.65  		return true;
   12.66 -	}
   12.67  	else
   12.68  	{
   12.69 -		apr_thread_mutex_unlock(mAPRMutexp);
   12.70 +		mMutex.unlock();
   12.71  		return false;
   12.72  	}
   12.73  }
   12.74 @@ -141,12 +118,9 @@
   12.75  		return true;
   12.76  	}
   12.77  	
   12.78 -	apr_status_t status(apr_thread_mutex_trylock(mAPRMutexp));
   12.79 -	if (APR_STATUS_IS_EBUSY(status))
   12.80 -	{
   12.81 +	if (!mMutex.try_lock())
   12.82  		return false;
   12.83 -	}
   12.84 -	
   12.85 +
   12.86  #if MUTEX_DEBUG
   12.87  	// Have to have the lock before we can access the debug info
   12.88  	U32 id = LLThread::currentID();
   12.89 @@ -161,44 +135,28 @@
   12.90  
   12.91  //============================================================================
   12.92  
   12.93 -LLCondition::LLCondition(apr_pool_t *poolp) :
   12.94 -	LLMutex(poolp)
   12.95 +LLCondition::LLCondition()
   12.96  {
   12.97 -	// base class (LLMutex) has already ensured that mAPRPoolp is set up.
   12.98 -
   12.99 -	apr_thread_cond_create(&mAPRCondp, mAPRPoolp);
  12.100  }
  12.101  
  12.102 -
  12.103  LLCondition::~LLCondition()
  12.104  {
  12.105 -	apr_thread_cond_destroy(mAPRCondp);
  12.106 -	mAPRCondp = NULL;
  12.107  }
  12.108  
  12.109 -
  12.110  void LLCondition::wait()
  12.111  {
  12.112 -	if (!isLocked())
  12.113 -	{ //mAPRMutexp MUST be locked before calling apr_thread_cond_wait
  12.114 -		apr_thread_mutex_lock(mAPRMutexp);
  12.115 -#if MUTEX_DEBUG
  12.116 -		// avoid asserts on destruction in non-release builds
  12.117 -		U32 id = LLThread::currentID();
  12.118 -		mIsLocked[id] = TRUE;
  12.119 -#endif
  12.120 -	}
  12.121 -	apr_thread_cond_wait(mAPRCondp, mAPRMutexp);
  12.122 +	std::unique_lock< std::mutex > lock( mMutex );
  12.123 +	mCond.wait( lock );
  12.124  }
  12.125  
  12.126  void LLCondition::signal()
  12.127  {
  12.128 -	apr_thread_cond_signal(mAPRCondp);
  12.129 +	mCond.notify_one() ;
  12.130  }
  12.131  
  12.132  void LLCondition::broadcast()
  12.133  {
  12.134 -	apr_thread_cond_broadcast(mAPRCondp);
  12.135 +	mCond.notify_all();
  12.136  }
  12.137  
  12.138  
    13.1 --- a/indra/llcommon/llmutex.h	Tue May 01 16:45:50 2018 +0200
    13.2 +++ b/indra/llcommon/llmutex.h	Tue May 08 18:31:13 2018 +0200
    13.3 @@ -28,10 +28,18 @@
    13.4  #define LL_LLMUTEX_H
    13.5  
    13.6  #include "stdtypes.h"
    13.7 -#if !LL_WINDOWS
    13.8 -#include <stdint.h>
    13.9 +#include "lltimer.h"
   13.10 +
   13.11 +#if LL_WINDOWS
   13.12 +#pragma warning(disable:4265)
   13.13  #endif
   13.14  
   13.15 +#include <mutex>
   13.16 +#include <condition_variable>
   13.17 +
   13.18 +#if LL_WINDOWS
   13.19 +#pragma warning(default:4265)
   13.20 +#endif
   13.21  //============================================================================
   13.22  
   13.23  #define MUTEX_DEBUG (LL_DEBUG || LL_RELEASE_WITH_DEBUG_INFO)
   13.24 @@ -40,9 +48,6 @@
   13.25  #include <map>
   13.26  #endif
   13.27  
   13.28 -struct apr_thread_mutex_t;
   13.29 -struct apr_pool_t;
   13.30 -struct apr_thread_cond_t;
   13.31  
   13.32  class LL_COMMON_API LLMutex
   13.33  {
   13.34 @@ -52,7 +57,7 @@
   13.35  		NO_THREAD = 0xFFFFFFFF
   13.36  	} e_locking_thread;
   13.37  
   13.38 -	LLMutex(apr_pool_t *apr_poolp = NULL); // NULL pool constructs a new pool for the mutex
   13.39 +	LLMutex(); // NULL pool constructs a new pool for the mutex
   13.40  	virtual ~LLMutex();
   13.41  	
   13.42  	void lock();		// blocks
   13.43 @@ -63,12 +68,11 @@
   13.44  	U32 lockingThread() const; //get ID of locking thread
   13.45  	
   13.46  protected:
   13.47 -	apr_thread_mutex_t *mAPRMutexp;
   13.48 +	std::mutex mMutex;
   13.49  	mutable U32			mCount;
   13.50  	mutable U32			mLockingThread;
   13.51  	
   13.52 -	apr_pool_t			*mAPRPoolp;
   13.53 -	BOOL				mIsLocalPool;
   13.54 +	bool				mIsLocalPool;
   13.55  	
   13.56  #if MUTEX_DEBUG
   13.57  	std::map<U32, BOOL> mIsLocked;
   13.58 @@ -79,7 +83,7 @@
   13.59  class LL_COMMON_API LLCondition : public LLMutex
   13.60  {
   13.61  public:
   13.62 -	LLCondition(apr_pool_t* apr_poolp); // Defaults to global pool, could use the thread pool as well.
   13.63 +	LLCondition(); // Defaults to global pool, could use the thread pool as well.
   13.64  	~LLCondition();
   13.65  	
   13.66  	void wait();		// blocks
   13.67 @@ -87,7 +91,7 @@
   13.68  	void broadcast();
   13.69  	
   13.70  protected:
   13.71 -	apr_thread_cond_t* mAPRCondp;
   13.72 +	std::condition_variable mCond;
   13.73  };
   13.74  
   13.75  class LLMutexLock
   13.76 @@ -129,6 +133,23 @@
   13.77  		if (mMutex)
   13.78  			mLocked = mMutex->trylock();
   13.79  	}
   13.80 +	LLMutexTrylock( LLMutex* mutex, U32 aTries )
   13.81 +		: mMutex( mutex ),
   13.82 +		mLocked( false )
   13.83 +	{
   13.84 +		if( !mMutex )
   13.85 +			return;
   13.86 +
   13.87 +		U32 i = 0;
   13.88 +		while( i < aTries )
   13.89 +		{
   13.90 +			mLocked = mMutex->trylock();
   13.91 +			if( mLocked )
   13.92 +				break;
   13.93 +			++i;
   13.94 +			ms_sleep( 10 );
   13.95 +		}
   13.96 +	}
   13.97  
   13.98  	~LLMutexTrylock()
   13.99  	{
    14.1 --- a/indra/llcommon/llqueuedthread.cpp	Tue May 01 16:45:50 2018 +0200
    14.2 +++ b/indra/llcommon/llqueuedthread.cpp	Tue May 08 18:31:13 2018 +0200
    14.3 @@ -36,10 +36,10 @@
    14.4  LLQueuedThread::LLQueuedThread(const std::string& name, bool threaded, bool should_pause) :
    14.5  	LLThread(name),
    14.6  	mThreaded(threaded),
    14.7 -	mIdleThread(TRUE),
    14.8  	mNextHandle(0),
    14.9  	mStarted(FALSE)
   14.10  {
   14.11 +	mIdleThread = true;
   14.12  	if (mThreaded)
   14.13  	{
   14.14  		if(should_pause)
    15.1 --- a/indra/llcommon/llqueuedthread.h	Tue May 01 16:45:50 2018 +0200
    15.2 +++ b/indra/llcommon/llqueuedthread.h	Tue May 08 18:31:13 2018 +0200
    15.3 @@ -128,7 +128,7 @@
    15.4  		};
    15.5  		
    15.6  	protected:
    15.7 -		LLAtomic32<status_t> mStatus;
    15.8 +		LLAtomicBase<status_t> mStatus;
    15.9  		U32 mPriority;
   15.10  		U32 mFlags;
   15.11  	};
   15.12 @@ -198,7 +198,7 @@
   15.13  protected:
   15.14  	BOOL mThreaded;  // if false, run on main thread and do updates during update()
   15.15  	BOOL mStarted;  // required when mThreaded is false to call startThread() from update()
   15.16 -	LLAtomic32<BOOL> mIdleThread; // request queue is empty (or we are quitting) and the thread is idle
   15.17 +	LLAtomicBool mIdleThread; // request queue is empty (or we are quitting) and the thread is idle
   15.18  	
   15.19  	typedef std::set<QueuedRequest*, queued_request_less> request_queue_t;
   15.20  	request_queue_t mRequestQueue;
    16.1 --- a/indra/llcommon/llrefcount.h	Tue May 01 16:45:50 2018 +0200
    16.2 +++ b/indra/llcommon/llrefcount.h	Tue May 08 18:31:13 2018 +0200
    16.3 @@ -31,8 +31,6 @@
    16.4  #include "llmutex.h"
    16.5  #include "llapr.h"
    16.6  
    16.7 -#include "nd/ndintrin.h" // <FS:ND/> For FAA/FAD
    16.8 -
    16.9  #define LL_REF_COUNT_DEBUG 0
   16.10  #if LL_REF_COUNT_DEBUG
   16.11  class LLMutex ;
   16.12 @@ -59,24 +57,13 @@
   16.13  #else
   16.14  	inline void ref() const
   16.15  	{ 
   16.16 -		// <FS:ND> Use intrinsic functions for threadsafe increment
   16.17 -
   16.18 -		//	++mRef;
   16.19 -		nd::intrin::FAA( &mRef );
   16.20 -
   16.21 -		// </FS:ND>
   16.22 +		mRef++; 
   16.23  	} 
   16.24  
   16.25  	inline S32 unref() const
   16.26  	{
   16.27  		llassert(mRef >= 1);
   16.28 -
   16.29 -		// <FS:ND> Use intrinsic functions for threadsafe decrement
   16.30 -
   16.31 -		//		if (0 == --mRef)
   16.32 -		if (0 == nd::intrin::FAD( &mRef) )
   16.33 -
   16.34 -		// </FS:ND>
   16.35 +		if (0 == --mRef)
   16.36  		{
   16.37  			delete this; 
   16.38  			return 0;
   16.39 @@ -93,12 +80,7 @@
   16.40  	}
   16.41  
   16.42  private: 
   16.43 -	// <FS:ND> Needs to be volatile and U32
   16.44 -
   16.45 -	//	mutable S32	mRef; 
   16.46 -	mutable volatile U32 mRef; 
   16.47 -
   16.48 -	// </FS:ND>
   16.49 +	mutable S32	mRef; 
   16.50  
   16.51  #if LL_REF_COUNT_DEBUG
   16.52  	LLMutex*  mMutexp ;
   16.53 @@ -158,7 +140,7 @@
   16.54  	}
   16.55  
   16.56  private: 
   16.57 -	LLAtomic32< S32	> mRef; 
   16.58 +	LLAtomicS32 mRef;
   16.59  };
   16.60  
   16.61  /**
    17.1 --- a/indra/llcommon/llthread.cpp	Tue May 01 16:45:50 2018 +0200
    17.2 +++ b/indra/llcommon/llthread.cpp	Tue May 08 18:31:13 2018 +0200
    17.3 @@ -116,29 +116,27 @@
    17.4  //
    17.5  // Handed to the APR thread creation function
    17.6  //
    17.7 -void *APR_THREAD_FUNC LLThread::staticRun(apr_thread_t *apr_threadp, void *datap)
    17.8 +void  LLThread::threadRun()
    17.9  {
   17.10 -    LLThread *threadp = (LLThread *)datap;
   17.11 -
   17.12  #ifdef LL_WINDOWS
   17.13 -    set_thread_name(-1, threadp->mName.c_str());
   17.14 +	set_thread_name( -1, mName.c_str() );
   17.15  #endif
   17.16  
   17.17      // for now, hard code all LLThreads to report to single master thread recorder, which is known to be running on main thread
   17.18 -    threadp->mRecorder = new LLTrace::ThreadRecorder(*LLTrace::get_master_thread_recorder());
   17.19 +	mRecorder = new LLTrace::ThreadRecorder( *LLTrace::get_master_thread_recorder() );
   17.20  
   17.21 -    sThreadID = threadp->mID;
   17.22 +	sThreadID = mID;
   17.23  
   17.24      // Run the user supplied function
   17.25      do 
   17.26      {
   17.27          try
   17.28          {
   17.29 -            threadp->run();
   17.30 +			run();
   17.31          }
   17.32          catch (const LLContinueError &e)
   17.33          {
   17.34 -            LL_WARNS("THREAD") << "ContinueException on thread '" << threadp->mName <<
   17.35 +			LL_WARNS( "THREAD" ) << "ContinueException on thread '" << mName <<
   17.36                  "' reentering run(). Error what is: '" << e.what() << "'" << LL_ENDL;
   17.37              //output possible call stacks to log file.
   17.38              LLError::LLCallStacks::print();
   17.39 @@ -153,41 +151,30 @@
   17.40      //LL_INFOS() << "LLThread::staticRun() Exiting: " << threadp->mName << LL_ENDL;
   17.41  
   17.42  
   17.43 -    delete threadp->mRecorder;
   17.44 -    threadp->mRecorder = NULL;
   17.45 +    delete mRecorder;
   17.46 +    mRecorder = nullptr;
   17.47  
   17.48      // We're done with the run function, this thread is done executing now.
   17.49      //NB: we are using this flag to sync across threads...we really need memory barriers here
   17.50      // Todo: add LLMutex per thread instead of flag?
   17.51      // We are using "while (mStatus != STOPPED) {ms_sleep();}" everywhere.
   17.52 -    threadp->mStatus = STOPPED;
   17.53 +    mStatus = STOPPED;
   17.54  
   17.55 -    return NULL;
   17.56 +    return;
   17.57  }
   17.58  
   17.59  LLThread::LLThread(const std::string& name, apr_pool_t *poolp) :
   17.60      mPaused(FALSE),
   17.61      mName(name),
   17.62 -    mAPRThreadp(NULL),
   17.63 +    mThreadp(NULL),
   17.64      mStatus(STOPPED),
   17.65      mRecorder(NULL)
   17.66  {
   17.67  
   17.68      mID = ++sIDIter;
   17.69 -
   17.70 -    // Thread creation probably CAN be paranoid about APR being initialized, if necessary
   17.71 -    if (poolp)
   17.72 -    {
   17.73 -        mIsLocalPool = FALSE;
   17.74 -        mAPRPoolp = poolp;
   17.75 -    }
   17.76 -    else
   17.77 -    {
   17.78 -        mIsLocalPool = TRUE;
   17.79 -        apr_pool_create(&mAPRPoolp, NULL); // Create a subpool for this thread
   17.80 -    }
   17.81 -    mRunCondition = new LLCondition(mAPRPoolp);
   17.82 -    mDataLock = new LLMutex(mAPRPoolp);
   17.83 +	
   17.84 +    mRunCondition = new LLCondition();
   17.85 +    mDataLock = new LLMutex();
   17.86      mLocalAPRFilePoolp = NULL ;
   17.87  }
   17.88  
   17.89 @@ -217,7 +204,7 @@
   17.90  
   17.91      // Warning!  If you somehow call the thread destructor from itself,
   17.92      // the thread will die in an unclean fashion!
   17.93 -    if (mAPRThreadp)
   17.94 +	if( mThreadp )
   17.95      {
   17.96          if (!isStopped())
   17.97          {
   17.98 @@ -251,10 +238,12 @@
   17.99              // Put a stake in its heart.
  17.100              delete mRecorder;
  17.101  
  17.102 -            apr_thread_exit(mAPRThreadp, -1);
  17.103 +			// ND: There is no such thing as to terminate a std::thread, we detach it so no wait will happen.
  17.104 +			// Otherwise craft something platform specific with std::thread::native_handle
  17.105 +			mThreadp->detach();
  17.106              return;
  17.107          }
  17.108 -        mAPRThreadp = NULL;
  17.109 +		mThreadp = NULL;
  17.110      }
  17.111  
  17.112      delete mRunCondition;
  17.113 @@ -263,12 +252,6 @@
  17.114      delete mDataLock;
  17.115      mDataLock = NULL;
  17.116      
  17.117 -    if (mIsLocalPool && mAPRPoolp)
  17.118 -    {
  17.119 -        apr_pool_destroy(mAPRPoolp);
  17.120 -        mAPRPoolp = 0;
  17.121 -    }
  17.122 -
  17.123      if (mRecorder)
  17.124      {
  17.125          // missed chance to properly shut down recorder (needs to be done in thread context)
  17.126 @@ -286,21 +269,16 @@
  17.127      // Set thread state to running
  17.128      mStatus = RUNNING;
  17.129  
  17.130 -    apr_status_t status =
  17.131 -        apr_thread_create(&mAPRThreadp, NULL, staticRun, (void *)this, mAPRPoolp);
  17.132 -    
  17.133 -    if(status == APR_SUCCESS)
  17.134 -    {   
  17.135 -        // We won't bother joining
  17.136 -        apr_thread_detach(mAPRThreadp);
  17.137 +	try
  17.138 +	{
  17.139 +		mThreadp = new std::thread( std::bind( &LLThread::threadRun, this ) );
  17.140 +		//mThreadp->detach();
  17.141 +	}
  17.142 +	catch( std::system_error& ex )
  17.143 +	{
  17.144 +		mStatus = STOPPED;
  17.145 +		LL_WARNS() << "failed to start thread " << mName << " " << ex.what() << LL_ENDL;
  17.146      }
  17.147 -    else
  17.148 -    {
  17.149 -        mStatus = STOPPED;
  17.150 -        LL_WARNS() << "failed to start thread " << mName << LL_ENDL;
  17.151 -        ll_apr_warn_status(status);
  17.152 -    }
  17.153 -
  17.154  }
  17.155  
  17.156  //============================================================================
  17.157 @@ -375,11 +353,7 @@
  17.158  // static
  17.159  void LLThread::yield()
  17.160  {
  17.161 -#if LL_LINUX || LL_SOLARIS
  17.162 -    sched_yield(); // annoyingly, apr_thread_yield  is a noop on linux...
  17.163 -#else
  17.164 -    apr_thread_yield();
  17.165 -#endif
  17.166 +	std::this_thread::yield();
  17.167  }
  17.168  
  17.169  void LLThread::wake()
  17.170 @@ -412,7 +386,7 @@
  17.171  {
  17.172      if (!sMutex)
  17.173      {
  17.174 -        sMutex = new LLMutex(0);
  17.175 +        sMutex = new LLMutex();
  17.176      }
  17.177  }
  17.178  
  17.179 @@ -420,7 +394,7 @@
  17.180  void LLThreadSafeRefCount::cleanupThreadSafeRefCount()
  17.181  {
  17.182      delete sMutex;
  17.183 -    sMutex = NULL;
  17.184 +    sMutex = nullptr;
  17.185  }
  17.186      
  17.187  
    18.1 --- a/indra/llcommon/llthread.h	Tue May 01 16:45:50 2018 +0200
    18.2 +++ b/indra/llcommon/llthread.h	Tue May 08 18:31:13 2018 +0200
    18.3 @@ -34,6 +34,8 @@
    18.4  #include "llmutex.h"
    18.5  #include "llrefcount.h"
    18.6  
    18.7 +#include <thread>
    18.8 +
    18.9  LL_COMMON_API void assert_main_thread();
   18.10  
   18.11  namespace LLTrace
   18.12 @@ -86,7 +88,6 @@
   18.13      // this kicks off the apr thread
   18.14      void start(void);
   18.15  
   18.16 -    apr_pool_t *getAPRPool() { return mAPRPoolp; }
   18.17      LLVolatileAPRPool* getLocalAPRFilePool() { return mLocalAPRFilePoolp ; }
   18.18  
   18.19      U32 getID() const { return mID; }
   18.20 @@ -97,19 +98,16 @@
   18.21      static void registerThreadID();
   18.22      
   18.23  private:
   18.24 -    BOOL                mPaused;
   18.25 +    bool                mPaused;
   18.26      
   18.27 -    // static function passed to APR thread creation routine
   18.28 -    static void *APR_THREAD_FUNC staticRun(struct apr_thread_t *apr_threadp, void *datap);
   18.29 +	void threadRun(  );
   18.30  
   18.31  protected:
   18.32      std::string         mName;
   18.33      class LLCondition*  mRunCondition;
   18.34      LLMutex*            mDataLock;
   18.35  
   18.36 -    apr_thread_t        *mAPRThreadp;
   18.37 -    apr_pool_t          *mAPRPoolp;
   18.38 -    BOOL                mIsLocalPool;
   18.39 +    std::thread         *mThreadp;
   18.40      EThreadStatus       mStatus;
   18.41      U32                 mID;
   18.42      LLTrace::ThreadRecorder* mRecorder;
    19.1 --- a/indra/llcommon/llthreadsafequeue.cpp	Tue May 01 16:45:50 2018 +0200
    19.2 +++ b/indra/llcommon/llthreadsafequeue.cpp	Tue May 08 18:31:13 2018 +0200
    19.3 @@ -23,88 +23,6 @@
    19.4   * $/LicenseInfo$
    19.5   */
    19.6  
    19.7 -#include "linden_common.h"
    19.8 -#include <apr_pools.h>
    19.9 -#include <apr_queue.h>
   19.10 -#include "llthreadsafequeue.h"
   19.11 -#include "llexception.h"
   19.12 +//#include "linden_common.h"
   19.13 +//#include "llthreadsafequeue.h"
   19.14  
   19.15 -
   19.16 -
   19.17 -// LLThreadSafeQueueImplementation
   19.18 -//-----------------------------------------------------------------------------
   19.19 -
   19.20 -
   19.21 -LLThreadSafeQueueImplementation::LLThreadSafeQueueImplementation(apr_pool_t * pool, unsigned int capacity):
   19.22 -	mOwnsPool(pool == 0),
   19.23 -	mPool(pool),
   19.24 -	mQueue(0)
   19.25 -{
   19.26 -	if(mOwnsPool) {
   19.27 -		apr_status_t status = apr_pool_create(&mPool, 0);
   19.28 -		if(status != APR_SUCCESS) LLTHROW(LLThreadSafeQueueError("failed to allocate pool"));
   19.29 -	} else {
   19.30 -		; // No op.
   19.31 -	}
   19.32 -	
   19.33 -	apr_status_t status = apr_queue_create(&mQueue, capacity, mPool);
   19.34 -	if(status != APR_SUCCESS) LLTHROW(LLThreadSafeQueueError("failed to allocate queue"));
   19.35 -}
   19.36 -
   19.37 -
   19.38 -LLThreadSafeQueueImplementation::~LLThreadSafeQueueImplementation()
   19.39 -{
   19.40 -	if(mQueue != 0) {
   19.41 -		if(apr_queue_size(mQueue) != 0) LL_WARNS() << 
   19.42 -			"terminating queue which still contains " << apr_queue_size(mQueue) <<
   19.43 -			" elements;" << "memory will be leaked" << LL_ENDL;
   19.44 -		apr_queue_term(mQueue);
   19.45 -	}
   19.46 -	if(mOwnsPool && (mPool != 0)) apr_pool_destroy(mPool);
   19.47 -}
   19.48 -
   19.49 -
   19.50 -void LLThreadSafeQueueImplementation::pushFront(void * element)
   19.51 -{
   19.52 -	apr_status_t status = apr_queue_push(mQueue, element);
   19.53 -	
   19.54 -	if(status == APR_EINTR) {
   19.55 -		LLTHROW(LLThreadSafeQueueInterrupt());
   19.56 -	} else if(status != APR_SUCCESS) {
   19.57 -		LLTHROW(LLThreadSafeQueueError("push failed"));
   19.58 -	} else {
   19.59 -		; // Success.
   19.60 -	}
   19.61 -}
   19.62 -
   19.63 -
   19.64 -bool LLThreadSafeQueueImplementation::tryPushFront(void * element){
   19.65 -	return apr_queue_trypush(mQueue, element) == APR_SUCCESS;
   19.66 -}
   19.67 -
   19.68 -
   19.69 -void * LLThreadSafeQueueImplementation::popBack(void)
   19.70 -{
   19.71 -	void * element;
   19.72 -	apr_status_t status = apr_queue_pop(mQueue, &element);
   19.73 -
   19.74 -	if(status == APR_EINTR) {
   19.75 -		LLTHROW(LLThreadSafeQueueInterrupt());
   19.76 -	} else if(status != APR_SUCCESS) {
   19.77 -		LLTHROW(LLThreadSafeQueueError("pop failed"));
   19.78 -	} else {
   19.79 -		return element;
   19.80 -	}
   19.81 -}
   19.82 -
   19.83 -
   19.84 -bool LLThreadSafeQueueImplementation::tryPopBack(void *& element)
   19.85 -{
   19.86 -	return apr_queue_trypop(mQueue, &element) == APR_SUCCESS;
   19.87 -}
   19.88 -
   19.89 -
   19.90 -size_t LLThreadSafeQueueImplementation::size()
   19.91 -{
   19.92 -	return apr_queue_size(mQueue);
   19.93 -}
    20.1 --- a/indra/llcommon/llthreadsafequeue.h	Tue May 01 16:45:50 2018 +0200
    20.2 +++ b/indra/llcommon/llthreadsafequeue.h	Tue May 08 18:31:13 2018 +0200
    20.3 @@ -28,12 +28,10 @@
    20.4  #define LL_LLTHREADSAFEQUEUE_H
    20.5  
    20.6  #include "llexception.h"
    20.7 +#include "llmutex.h"
    20.8 +#include "lltimer.h"
    20.9  #include <string>
   20.10 -
   20.11 -
   20.12 -struct apr_pool_t; // From apr_pools.h
   20.13 -class LLThreadSafeQueueImplementation; // See below.
   20.14 -
   20.15 +#include <deque>
   20.16  
   20.17  //
   20.18  // A general queue exception.
   20.19 @@ -65,29 +63,6 @@
   20.20  };
   20.21  
   20.22  
   20.23 -struct apr_queue_t; // From apr_queue.h
   20.24 -
   20.25 -
   20.26 -//
   20.27 -// Implementation details. 
   20.28 -//
   20.29 -class LL_COMMON_API LLThreadSafeQueueImplementation
   20.30 -{
   20.31 -public:
   20.32 -	LLThreadSafeQueueImplementation(apr_pool_t * pool, unsigned int capacity);
   20.33 -	~LLThreadSafeQueueImplementation();
   20.34 -	void pushFront(void * element);
   20.35 -	bool tryPushFront(void * element);
   20.36 -	void * popBack(void);
   20.37 -	bool tryPopBack(void *& element);
   20.38 -	size_t size();
   20.39 -	
   20.40 -private:
   20.41 -	bool mOwnsPool;
   20.42 -	apr_pool_t * mPool;
   20.43 -	apr_queue_t * mQueue;
   20.44 -};
   20.45 -
   20.46  
   20.47  //
   20.48  // Implements a thread safe FIFO.
   20.49 @@ -100,7 +75,7 @@
   20.50  	
   20.51  	// If the pool is set to NULL one will be allocated and managed by this
   20.52  	// queue.
   20.53 -	LLThreadSafeQueue(apr_pool_t * pool = 0, unsigned int capacity = 1024);
   20.54 +	LLThreadSafeQueue( U32 capacity = 1024);
   20.55  	
   20.56  	// Add an element to the front of queue (will block if the queue has
   20.57  	// reached capacity).
   20.58 @@ -128,7 +103,9 @@
   20.59  	size_t size();
   20.60  
   20.61  private:
   20.62 -	LLThreadSafeQueueImplementation mImplementation;
   20.63 +	std::deque< ElementT > mStorage;
   20.64 +	LLCondition mLock;;
   20.65 +	U32 mCapacity; // Really needed?
   20.66  };
   20.67  
   20.68  
   20.69 @@ -138,8 +115,8 @@
   20.70  
   20.71  
   20.72  template<typename ElementT>
   20.73 -LLThreadSafeQueue<ElementT>::LLThreadSafeQueue(apr_pool_t * pool, unsigned int capacity):
   20.74 -	mImplementation(pool, capacity)
   20.75 +LLThreadSafeQueue<ElementT>::LLThreadSafeQueue( U32 capacity):
   20.76 +	mCapacity( capacity )
   20.77  {
   20.78  	; // No op.
   20.79  }
   20.80 @@ -148,12 +125,18 @@
   20.81  template<typename ElementT>
   20.82  void LLThreadSafeQueue<ElementT>::pushFront(ElementT const & element)
   20.83  {
   20.84 -	ElementT * elementCopy = new ElementT(element);
   20.85 -	try {
   20.86 -		mImplementation.pushFront(elementCopy);
   20.87 -	} catch (LLThreadSafeQueueInterrupt) {
   20.88 -		delete elementCopy;
   20.89 -		throw;
   20.90 +	while( true )
   20.91 +	{
   20.92 +		{
   20.93 +			LLMutexLock lck( &mLock );
   20.94 +			if( mStorage.size() < mCapacity )
   20.95 +			{
   20.96 +				mStorage.push_front( element );
   20.97 +				mLock.signal();
   20.98 +				return;
   20.99 +			}
  20.100 +		}
  20.101 +		ms_sleep( 100 );
  20.102  	}
  20.103  }
  20.104  
  20.105 @@ -161,43 +144,58 @@
  20.106  template<typename ElementT>
  20.107  bool LLThreadSafeQueue<ElementT>::tryPushFront(ElementT const & element)
  20.108  {
  20.109 -	ElementT * elementCopy = new ElementT(element);
  20.110 -	bool result = mImplementation.tryPushFront(elementCopy);
  20.111 -	if(!result) delete elementCopy;
  20.112 -	return result;
  20.113 +	LLMutexTrylock lck( &mLock );
  20.114 +	if( !lck.isLocked() )
  20.115 +		return false;
  20.116 +
  20.117 +	if( mStorage.size() >= mCapacity )
  20.118 +		return false;
  20.119 +
  20.120 +	mStorage.push_front( element );
  20.121 +	mLock.signal();
  20.122 +	return true;
  20.123  }
  20.124  
  20.125  
  20.126  template<typename ElementT>
  20.127  ElementT LLThreadSafeQueue<ElementT>::popBack(void)
  20.128  {
  20.129 -	ElementT * element = reinterpret_cast<ElementT *> (mImplementation.popBack());
  20.130 -	ElementT result(*element);
  20.131 -	delete element;
  20.132 -	return result;
  20.133 +	while( true )
  20.134 +	{
  20.135 +		mLock.wait();
  20.136 +		if( !mStorage.empty() )
  20.137 +		{
  20.138 +			ElementT value = mStorage.back();
  20.139 +			mStorage.pop_back();
  20.140 +			return value;
  20.141 +		}
  20.142 +	}
  20.143  }
  20.144  
  20.145  
  20.146  template<typename ElementT>
  20.147  bool LLThreadSafeQueue<ElementT>::tryPopBack(ElementT & element)
  20.148  {
  20.149 -	void * storedElement;
  20.150 -	bool result = mImplementation.tryPopBack(storedElement);
  20.151 -	if(result) {
  20.152 -		ElementT * elementPtr = reinterpret_cast<ElementT *>(storedElement); 
  20.153 -		element = *elementPtr;
  20.154 -		delete elementPtr;
  20.155 -	} else {
  20.156 -		; // No op.
  20.157 -	}
  20.158 -	return result;
  20.159 +	LLMutexTrylock lck( &mLock );
  20.160 +
  20.161 +	if( !lck.isLocked() )
  20.162 +		return false;
  20.163 +	if( mStorage.empty() )
  20.164 +		return false;
  20.165 +
  20.166 +	element = mStorage.back();
  20.167 +	mStorage.pop_back();
  20.168 +	return true;
  20.169  }
  20.170  
  20.171  
  20.172  template<typename ElementT>
  20.173  size_t LLThreadSafeQueue<ElementT>::size(void)
  20.174  {
  20.175 -	return mImplementation.size();
  20.176 +	// Nicky: apr_queue_size is/was NOT threadsafe. I still play it safe here and rather lock the storage
  20.177 +
  20.178 +	LLMutexLock lck( &mLock );
  20.179 +	return mStorage.size();
  20.180  }
  20.181  
  20.182  
    21.1 --- a/indra/llcommon/lluuid.cpp	Tue May 01 16:45:50 2018 +0200
    21.2 +++ b/indra/llcommon/lluuid.cpp	Tue May 08 18:31:13 2018 +0200
    21.3 @@ -739,7 +739,7 @@
    21.4        getSystemTime(&time_last);
    21.5        uuids_this_tick = uuids_per_tick;
    21.6        init = TRUE;
    21.7 -	  mMutex = new LLMutex(NULL);
    21.8 +	  mMutex = new LLMutex();
    21.9     }
   21.10  
   21.11     uuid_time_t time_now = {0,0};
    22.1 --- a/indra/llcommon/llworkerthread.cpp	Tue May 01 16:45:50 2018 +0200
    22.2 +++ b/indra/llcommon/llworkerthread.cpp	Tue May 08 18:31:13 2018 +0200
    22.3 @@ -37,7 +37,7 @@
    22.4  LLWorkerThread::LLWorkerThread(const std::string& name, bool threaded, bool should_pause) :
    22.5  	LLQueuedThread(name, threaded, should_pause)
    22.6  {
    22.7 -	mDeleteMutex = new LLMutex(NULL);
    22.8 +	mDeleteMutex = new LLMutex();
    22.9  
   22.10  	if(!mLocalAPRFilePoolp)
   22.11  	{
   22.12 @@ -204,7 +204,6 @@
   22.13  	  mWorkerClassName(name),
   22.14  	  mRequestHandle(LLWorkerThread::nullHandle()),
   22.15  	  mRequestPriority(LLWorkerThread::PRIORITY_NORMAL),
   22.16 -	  mMutex(NULL),
   22.17  	  mWorkFlags(0)
   22.18  {
   22.19  	if (!mWorkerThread)
    23.1 --- a/indra/llcommon/nd/ndboolswitch.h	Tue May 01 16:45:50 2018 +0200
    23.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    23.3 @@ -1,67 +0,0 @@
    23.4 -#ifndef NDBOOLSWITCH_H
    23.5 -#define NDBOOLSWITCH_H
    23.6 -
    23.7 -/**
    23.8 - * $LicenseInfo:firstyear=2013&license=fsviewerlgpl$
    23.9 - * Phoenix Firestorm Viewer Source Code
   23.10 - * Copyright (C) 2013, Nicky Dasmijn
   23.11 - *
   23.12 - * This library is free software; you can redistribute it and/or
   23.13 - * modify it under the terms of the GNU Lesser General Public
   23.14 - * License as published by the Free Software Foundation;
   23.15 - * version 2.1 of the License only.
   23.16 - *
   23.17 - * This library is distributed in the hope that it will be useful,
   23.18 - * but WITHOUT ANY WARRANTY; without even the implied warranty of
   23.19 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
   23.20 - * Lesser General Public License for more details.
   23.21 - *
   23.22 - * You should have received a copy of the GNU Lesser General Public
   23.23 - * License along with this library; if not, write to the Free Software
   23.24 - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
   23.25 - *
   23.26 - * The Phoenix Firestorm Project, Inc., 1831 Oakwood Drive, Fairmont, Minnesota 56031-3225 USA
   23.27 - * http://www.firestormviewer.org
   23.28 - * $/LicenseInfo$
   23.29 - */
   23.30 -
   23.31 -namespace nd
   23.32 -{
   23.33 -	namespace utils
   23.34 -	{
   23.35 -		class boolSwitch
   23.36 -		{
   23.37 -			bool *mLocation;
   23.38 -			bool mOriginalValue;
   23.39 -			bool mNeedsReset;
   23.40 -		public:
   23.41 -			boolSwitch( bool *aLocation, bool aValue )
   23.42 -				: mLocation( aLocation )
   23.43 -				, mNeedsReset( false )
   23.44 -			{
   23.45 -				if( mLocation )
   23.46 -				{
   23.47 -					mOriginalValue = *mLocation;
   23.48 -					mNeedsReset = true;
   23.49 -					*mLocation = aValue;
   23.50 -				}
   23.51 -			}
   23.52 -
   23.53 -			~boolSwitch( )
   23.54 -			{
   23.55 -				reset();
   23.56 -			}
   23.57 -
   23.58 -			void reset()
   23.59 -			{
   23.60 -				if( mLocation && mNeedsReset )
   23.61 -					*mLocation = mOriginalValue;
   23.62 -
   23.63 -				mNeedsReset = false;
   23.64 -			}
   23.65 -
   23.66 -		};
   23.67 -	}
   23.68 -}
   23.69 -
   23.70 -#endif
    24.1 --- a/indra/llcommon/nd/ndintrin.cpp	Tue May 01 16:45:50 2018 +0200
    24.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    24.3 @@ -1,49 +0,0 @@
    24.4 -/**
    24.5 - * $LicenseInfo:firstyear=2012&license=fsviewerlgpl$
    24.6 - * Phoenix Firestorm Viewer Source Code
    24.7 - * Copyright (C) 2012, Nicky Dasmijn
    24.8 - *
    24.9 - * This library is free software; you can redistribute it and/or
   24.10 - * modify it under the terms of the GNU Lesser General Public
   24.11 - * License as published by the Free Software Foundation;
   24.12 - * version 2.1 of the License only.
   24.13 - *
   24.14 - * This library is distributed in the hope that it will be useful,
   24.15 - * but WITHOUT ANY WARRANTY; without even the implied warranty of
   24.16 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
   24.17 - * Lesser General Public License for more details.
   24.18 - *
   24.19 - * You should have received a copy of the GNU Lesser General Public
   24.20 - * License along with this library; if not, write to the Free Software
   24.21 - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
   24.22 - *
   24.23 - * The Phoenix Firestorm Project, Inc., 1831 Oakwood Drive, Fairmont, Minnesota 56031-3225 USA
   24.24 - * http://www.firestormviewer.org
   24.25 - * $/LicenseInfo$
   24.26 - */
   24.27 -
   24.28 -#if LL_WINDOWS
   24.29 -#include "stdtypes.h"
   24.30 -#include "ndintrin.h"
   24.31 -
   24.32 -#include <Windows.h>
   24.33 -
   24.34 -namespace nd
   24.35 -{
   24.36 -	namespace intrin
   24.37 -	{
   24.38 -		U32 CAS( volatile U32 *aLoc, U32 aCmp, U32 aVal )
   24.39 -		{ return InterlockedCompareExchange( aLoc, aVal, aCmp ); }
   24.40 -
   24.41 -		void* CASPTR( void * volatile *aLoc, void* aCmp, void * aVal )
   24.42 -		{ return InterlockedCompareExchangePointer ( aLoc, aVal, aCmp ); }
   24.43 -
   24.44 -		void FAA( volatile U32 *aLoc )
   24.45 -		{ InterlockedIncrement( aLoc ); }
   24.46 -
   24.47 -		U32 FAD( volatile U32 *aLoc )
   24.48 -		{ return InterlockedDecrement( aLoc ); }
   24.49 -	}
   24.50 -}
   24.51 -
   24.52 -#endif
    25.1 --- a/indra/llcommon/nd/ndintrin.h	Tue May 01 16:45:50 2018 +0200
    25.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    25.3 @@ -1,65 +0,0 @@
    25.4 -#ifndef NDINTRIN_H
    25.5 -#define NDINTRIN_H
    25.6 -
    25.7 -/**
    25.8 - * $LicenseInfo:firstyear=2012&license=fsviewerlgpl$
    25.9 - * Phoenix Firestorm Viewer Source Code
   25.10 - * Copyright (C) 2012, Nicky Dasmijn
   25.11 - *
   25.12 - * This library is free software; you can redistribute it and/or
   25.13 - * modify it under the terms of the GNU Lesser General Public
   25.14 - * License as published by the Free Software Foundation;
   25.15 - * version 2.1 of the License only.
   25.16 - *
   25.17 - * This library is distributed in the hope that it will be useful,
   25.18 - * but WITHOUT ANY WARRANTY; without even the implied warranty of
   25.19 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
   25.20 - * Lesser General Public License for more details.
   25.21 - *
   25.22 - * You should have received a copy of the GNU Lesser General Public
   25.23 - * License along with this library; if not, write to the Free Software
   25.24 - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
   25.25 - *
   25.26 - * The Phoenix Firestorm Project, Inc., 1831 Oakwood Drive, Fairmont, Minnesota 56031-3225 USA
   25.27 - * http://www.firestormviewer.org
   25.28 - * $/LicenseInfo$
   25.29 - */
   25.30 -
   25.31 -
   25.32 -#include "stdtypes.h"
   25.33 -
   25.34 -#ifdef ND_DECL_GCC_INTRINSICS
   25.35 -
   25.36 -U32 __sync_val_compare_and_swap( volatile U32*, U32, U32 );
   25.37 -void* __sync_val_compare_and_swap( void volatile * aLoc, void *aCmp, void *aVal );
   25.38 -void __sync_add_and_fetch( volatile U32* aLoc, U32 );
   25.39 -U32 __sync_sub_and_fetch( volatile U32 *aLoc, U32 );
   25.40 -
   25.41 -#endif
   25.42 -
   25.43 -namespace nd
   25.44 -{
   25.45 -	namespace intrin
   25.46 -	{
   25.47 -	#if LL_WINDOWS
   25.48 -		U32 CAS( volatile U32 *aLoc, U32 aCmp, U32 aVal );
   25.49 -		void* CASPTR( void * volatile *aLoc, void* aCmp, void * aVal );
   25.50 -		void FAA( volatile U32 *aLoc );
   25.51 -		U32 FAD( volatile U32 *aLoc );
   25.52 -	#else
   25.53 -		inline U32  CAS( volatile U32 *aLoc, U32 aCmp, U32 aVal )
   25.54 -		{ return __sync_val_compare_and_swap( aLoc, aCmp, aVal ); }
   25.55 -
   25.56 -		inline void* CASPTR( void * volatile *aLoc, void* aCmp, void * aVal )
   25.57 -		{ return __sync_val_compare_and_swap( aLoc, aCmp, aVal ); }
   25.58 -
   25.59 -		inline void FAA( volatile U32 *aLoc )
   25.60 -		{ __sync_add_and_fetch( aLoc, 1 ); }
   25.61 -
   25.62 -		inline U32 FAD( volatile U32 *aLoc )
   25.63 -		{ return __sync_sub_and_fetch( aLoc,1 ); }
   25.64 -	#endif
   25.65 -	}
   25.66 -}
   25.67 -
   25.68 -#endif
    26.1 --- a/indra/llcommon/nd/ndlocks.h	Tue May 01 16:45:50 2018 +0200
    26.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    26.3 @@ -1,82 +0,0 @@
    26.4 -/**
    26.5 - * $LicenseInfo:firstyear=2012&license=fsviewerlgpl$
    26.6 - * Phoenix Firestorm Viewer Source Code
    26.7 - * Copyright (C) 2012, Nicky Dasmijn
    26.8 - *
    26.9 - * This library is free software; you can redistribute it and/or
   26.10 - * modify it under the terms of the GNU Lesser General Public
   26.11 - * License as published by the Free Software Foundation;
   26.12 - * version 2.1 of the License only.
   26.13 - *
   26.14 - * This library is distributed in the hope that it will be useful,
   26.15 - * but WITHOUT ANY WARRANTY; without even the implied warranty of
   26.16 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
   26.17 - * Lesser General Public License for more details.
   26.18 - *
   26.19 - * You should have received a copy of the GNU Lesser General Public
   26.20 - * License along with this library; if not, write to the Free Software
   26.21 - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
   26.22 - *
   26.23 - * The Phoenix Firestorm Project, Inc., 1831 Oakwood Drive, Fairmont, Minnesota 56031-3225 USA
   26.24 - * http://www.firestormviewer.org
   26.25 - * $/LicenseInfo$
   26.26 - */
   26.27 -
   26.28 -#ifndef NDLOCKS_H
   26.29 -#define NDLOCKS_H
   26.30 -
   26.31 -#include "ndintrin.h"
   26.32 -
   26.33 -namespace nd
   26.34 -{
   26.35 -	namespace locks
   26.36 -	{
   26.37 -		class NoLock
   26.38 -		{
   26.39 -		public:
   26.40 -			void lock(){}
   26.41 -			void unlock() {}
   26.42 -		};
   26.43 -
   26.44 -		inline void lock( volatile U32 *aLock )
   26.45 -		{
   26.46 -			while( 0 != nd::intrin::CAS( aLock, 0, 1 ) )
   26.47 -				;
   26.48 -		}
   26.49 -
   26.50 -		inline void unlock ( volatile U32 *aLock )
   26.51 -		{
   26.52 -			*aLock = 0;
   26.53 -		}
   26.54 -
   26.55 -		inline bool tryLock( volatile U32 *aLock )
   26.56 -		{
   26.57 -			return 0 == nd::intrin::CAS( aLock, 0, 1 );
   26.58 -		}
   26.59 -
   26.60 -		class LockHolder
   26.61 -		{
   26.62 -			volatile U32 *mLock;
   26.63 -		public:
   26.64 -			LockHolder( volatile U32 *aLock )
   26.65 -				: mLock( aLock )
   26.66 -			{
   26.67 -				if( mLock )
   26.68 -					lock( mLock );
   26.69 -			}
   26.70 -
   26.71 -			~LockHolder()
   26.72 -			{
   26.73 -				if( mLock )
   26.74 -					unlock( mLock );
   26.75 -			}
   26.76 -
   26.77 -			void attach( volatile U32 *aLock )
   26.78 -			{
   26.79 -				mLock = aLock;
   26.80 -			}
   26.81 -		};
   26.82 -	}
   26.83 -}
   26.84 -
   26.85 -#endif
    27.1 --- a/indra/llcommon/nd/ndobjectpool.h	Tue May 01 16:45:50 2018 +0200
    27.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    27.3 @@ -1,123 +0,0 @@
    27.4 -#ifndef NDOBJECTPOOL_H
    27.5 -#define NDOBJECTPOOL_H
    27.6 -
    27.7 -/**
    27.8 - * $LicenseInfo:firstyear=2013&license=fsviewerlgpl$
    27.9 - * Phoenix Firestorm Viewer Source Code
   27.10 - * Copyright (C) 2013, Nicky Dasmijn
   27.11 - *
   27.12 - * This library is free software; you can redistribute it and/or
   27.13 - * modify it under the terms of the GNU Lesser General Public
   27.14 - * License as published by the Free Software Foundation;
   27.15 - * version 2.1 of the License only.
   27.16 - *
   27.17 - * This library is distributed in the hope that it will be useful,
   27.18 - * but WITHOUT ANY WARRANTY; without even the implied warranty of
   27.19 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
   27.20 - * Lesser General Public License for more details.
   27.21 - *
   27.22 - * You should have received a copy of the GNU Lesser General Public
   27.23 - * License along with this library; if not, write to the Free Software
   27.24 - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
   27.25 - *
   27.26 - * The Phoenix Firestorm Project, Inc., 1831 Oakwood Drive, Fairmont, Minnesota 56031-3225 USA
   27.27 - * http://www.firestormviewer.org
   27.28 - * $/LicenseInfo$
   27.29 - */
   27.30 -
   27.31 -#include "ndlocks.h"
   27.32 -
   27.33 -namespace nd
   27.34 -{
   27.35 -	namespace objectpool
   27.36 -	{
   27.37 -		template<typename T, typename Lock = nd::locks::NoLock, int Alignment = 16, int AllocationSize = 32 > class ObjectPool
   27.38 -		{
   27.39 -			struct ObjectMemory
   27.40 -			{
   27.41 -				ObjectMemory *mNext;
   27.42 -			};
   27.43 -
   27.44 -			Lock mLock;
   27.45 -			unsigned int mObjectSize;
   27.46 -			ObjectMemory mMemory;
   27.47 -
   27.48 -			void grow()
   27.49 -			{
   27.50 -				char *pMemory = reinterpret_cast< char* >( ll_aligned_malloc( mObjectSize * AllocationSize, Alignment ) );
   27.51 -				ObjectMemory *pPrev = &mMemory;
   27.52 -
   27.53 -				for( int i = 0; i < AllocationSize; ++i )
   27.54 -				{
   27.55 -					ObjectMemory *pCur = reinterpret_cast< ObjectMemory* >( pMemory );
   27.56 -					pPrev->mNext = pCur;
   27.57 -					pPrev = pCur;
   27.58 -					pPrev->mNext = 0;
   27.59 -
   27.60 -					pMemory += mObjectSize;
   27.61 -				}
   27.62 -			}
   27.63 -
   27.64 -			void destroy()
   27.65 -			{
   27.66 -				// Just leak. Process is exiting and the OS will clean up after us. This is ok.
   27.67 -			}
   27.68 -
   27.69 -		public:
   27.70 -			ObjectPool()
   27.71 -			{
   27.72 -				mObjectSize = sizeof( T ) > sizeof(ObjectMemory) ? sizeof( T ) : sizeof(ObjectMemory);
   27.73 -				mObjectSize += Alignment-1;
   27.74 -				mObjectSize &= ~(Alignment-1);
   27.75 -				mMemory.mNext = 0;
   27.76 -			}
   27.77 -
   27.78 -			~ObjectPool()
   27.79 -			{
   27.80 -				this->destroy();
   27.81 -			}
   27.82 -
   27.83 -			T *allocMemoryForObject()
   27.84 -			{
   27.85 -				mLock.lock();
   27.86 -				if( !mMemory.mNext )
   27.87 -					this->grow();
   27.88 -
   27.89 -				ObjectMemory *pRet = mMemory.mNext;
   27.90 -				mMemory.mNext = pRet->mNext;
   27.91 -
   27.92 -				mLock.unlock();
   27.93 -
   27.94 -				T *pT = reinterpret_cast< T* >( pRet );
   27.95 -				return pT;
   27.96 -			}
   27.97 -
   27.98 -			T *allocObject()
   27.99 -			{
  27.100 -				T *pT = this->allocMemoryForObject();
  27.101 -				new (pT)T;
  27.102 -				return pT;
  27.103 -			}
  27.104 -
  27.105 -			void freeMemoryOfObject( void *aObject )
  27.106 -			{
  27.107 -				mLock.lock();
  27.108 -				ObjectMemory *pMemory = reinterpret_cast< ObjectMemory* >( aObject );
  27.109 -				pMemory->mNext = mMemory.mNext;
  27.110 -				mMemory.mNext = pMemory;
  27.111 -				mLock.unlock();
  27.112 -			}
  27.113 -
  27.114 -			void freeObject( T *aObject )
  27.115 -			{
  27.116 -				if( !aObject)
  27.117 -					return;
  27.118 -
  27.119 -				aObject->~T();
  27.120 -				this->freeMemoryOfObject( aObject );
  27.121 -			}
  27.122 -		};
  27.123 -	}
  27.124 -}
  27.125 -
  27.126 -#endif
    28.1 --- a/indra/llcommon/nd/ndstlallocator.h	Tue May 01 16:45:50 2018 +0200
    28.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    28.3 @@ -1,91 +0,0 @@
    28.4 -#ifndef NDSTLALLOCATOR_H
    28.5 -#define NDSTLALLOCATOR_H
    28.6 -
    28.7 -/**
    28.8 - * $LicenseInfo:firstyear=2013&license=fsviewerlgpl$
    28.9 - * Phoenix Firestorm Viewer Source Code
   28.10 - * Copyright (C) 2013, Nicky Dasmijn
   28.11 - *
   28.12 - * This library is free software; you can redistribute it and/or
   28.13 - * modify it under the terms of the GNU Lesser General Public
   28.14 - * License as published by the Free Software Foundation;
   28.15 - * version 2.1 of the License only.
   28.16 - *
   28.17 - * This library is distributed in the hope that it will be useful,
   28.18 - * but WITHOUT ANY WARRANTY; without even the implied warranty of
   28.19 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
   28.20 - * Lesser General Public License for more details.
   28.21 - *
   28.22 - * You should have received a copy of the GNU Lesser General Public
   28.23 - * License along with this library; if not, write to the Free Software
   28.24 - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
   28.25 - *
   28.26 - * The Phoenix Firestorm Project, Inc., 1831 Oakwood Drive, Fairmont, Minnesota 56031-3225 USA
   28.27 - * http://www.firestormviewer.org
   28.28 - * $/LicenseInfo$
   28.29 - */
   28.30 -
   28.31 -#include <limits>
   28.32 -#include <stdlib.h>
   28.33 -#include <cstddef>
   28.34 -
   28.35 -namespace nd
   28.36 -{
   28.37 -	namespace stl
   28.38 -	{
   28.39 -		template <typename T> class allocator
   28.40 -		{
   28.41 -		public:
   28.42 -			typedef size_t    size_type;
   28.43 -			typedef ptrdiff_t difference_type;
   28.44 -			typedef T*        pointer;
   28.45 -			typedef const T*  const_pointer;
   28.46 -			typedef T&        reference;
   28.47 -			typedef const T&  const_reference;
   28.48 -			typedef T         value_type;
   28.49 -
   28.50 -			template <typename V>	struct rebind
   28.51 -			{ typedef allocator<V> other; };
   28.52 -
   28.53 -			pointer address (reference value) const
   28.54 -			{ return &value; }
   28.55 -			
   28.56 -			const_pointer address (const_reference value) const
   28.57 -			{ return &value; }
   28.58 -
   28.59 -			allocator()
   28.60 -			{ }
   28.61 -
   28.62 -			allocator(const allocator&)
   28.63 -			{ }
   28.64 -
   28.65 -			template <typename V> allocator (const allocator<V>&)
   28.66 -			{ }
   28.67 -			
   28.68 -			~allocator()
   28.69 -			{ }
   28.70 -
   28.71 -			size_type max_size () const
   28.72 -			{ return std::numeric_limits<size_t>::max() / sizeof(T); }
   28.73 -
   28.74 -			pointer allocate (size_type num)
   28.75 -			{ return (pointer) ::malloc (num*sizeof(T)); }
   28.76 -
   28.77 -			void construct (pointer p, const T& value)
   28.78 -			{ new((void*)p)T(value); }
   28.79 -
   28.80 -			void destroy (pointer p)
   28.81 -			{ p->~T(); }
   28.82 -
   28.83 -			void deallocate (pointer p, size_type num)
   28.84 -			{ ::free((void*)p); }
   28.85 -		};
   28.86 -
   28.87 -		template <typename T1, typename T2> bool operator== (const allocator<T1>&, const allocator<T2>&) 
   28.88 -		{ return true; }
   28.89 -		template <typename T1, typename T2> bool operator!= (const allocator<T1>&, const allocator<T2>&) 
   28.90 -		{ return false; }
   28.91 -	}
   28.92 -}
   28.93 -
   28.94 -#endif
    29.1 --- a/indra/llcorehttp/httpcommon.cpp	Tue May 01 16:45:50 2018 +0200
    29.2 +++ b/indra/llcorehttp/httpcommon.cpp	Tue May 08 18:31:13 2018 +0200
    29.3 @@ -333,7 +333,7 @@
    29.4  
    29.5      if (!sHandleMutexp)
    29.6      {
    29.7 -        sHandleMutexp = new LLMutex(NULL);
    29.8 +        sHandleMutexp = new LLMutex();
    29.9      }
   29.10  
   29.11      return sHandleMutexp;
   29.12 @@ -389,7 +389,7 @@
   29.13      S32 mutex_count = CRYPTO_num_locks();
   29.14      for (S32 i = 0; i < mutex_count; i++)
   29.15      {
   29.16 -        sSSLMutex.push_back(LLMutex_ptr(new LLMutex(NULL)));
   29.17 +        sSSLMutex.push_back(LLMutex_ptr(new LLMutex()));
   29.18      }
   29.19      CRYPTO_set_id_callback(&ssl_thread_id);
   29.20      CRYPTO_set_locking_callback(&ssl_locking_callback);
    30.1 --- a/indra/llimage/llimage.cpp	Tue May 01 16:45:50 2018 +0200
    30.2 +++ b/indra/llimage/llimage.cpp	Tue May 08 18:31:13 2018 +0200
    30.3 @@ -609,7 +609,7 @@
    30.4  {
    30.5  	sUseNewByteRange = use_new_byte_range;
    30.6      sMinimalReverseByteRangePercent = minimal_reverse_byte_range_percent;
    30.7 -	sMutex = new LLMutex(NULL);
    30.8 +	sMutex = new LLMutex();
    30.9  }
   30.10  
   30.11  //static
    31.1 --- a/indra/llimage/llimageworker.cpp	Tue May 01 16:45:50 2018 +0200
    31.2 +++ b/indra/llimage/llimageworker.cpp	Tue May 08 18:31:13 2018 +0200
    31.3 @@ -35,7 +35,7 @@
    31.4  LLImageDecodeThread::LLImageDecodeThread(bool threaded)
    31.5  	: LLQueuedThread("imagedecode", threaded)
    31.6  {
    31.7 -	mCreationMutex = new LLMutex(getAPRPool());
    31.8 +	mCreationMutex = new LLMutex();
    31.9  }
   31.10  
   31.11  //virtual 
    32.1 --- a/indra/llmath/llvolumemgr.cpp	Tue May 01 16:45:50 2018 +0200
    32.2 +++ b/indra/llmath/llvolumemgr.cpp	Tue May 08 18:31:13 2018 +0200
    32.3 @@ -214,7 +214,7 @@
    32.4  { 
    32.5  	if (!mDataMutex)
    32.6  	{
    32.7 -		mDataMutex = new LLMutex(gAPRPoolp);
    32.8 +		mDataMutex = new LLMutex();
    32.9  	}
   32.10  }
   32.11  
    33.1 --- a/indra/llmessage/llbuffer.cpp	Tue May 01 16:45:50 2018 +0200
    33.2 +++ b/indra/llmessage/llbuffer.cpp	Tue May 08 18:31:13 2018 +0200
    33.3 @@ -265,7 +265,7 @@
    33.4  	{
    33.5  		if(!mMutexp)
    33.6  		{
    33.7 -			mMutexp = new LLMutex(NULL);
    33.8 +			mMutexp = new LLMutex();
    33.9  		}
   33.10  	}
   33.11  	else
    34.1 --- a/indra/llmessage/lliopipe.h	Tue May 01 16:45:50 2018 +0200
    34.2 +++ b/indra/llmessage/lliopipe.h	Tue May 08 18:31:13 2018 +0200
    34.3 @@ -36,8 +36,6 @@
    34.4  
    34.5  #include "llsd.h"
    34.6  
    34.7 -#include "nd/ndintrin.h"
    34.8 -
    34.9  class LLIOPipe;
   34.10  class LLPumpIO;
   34.11  class LLBufferArray;
    35.1 --- a/indra/llmessage/llproxy.cpp	Tue May 01 16:45:50 2018 +0200
    35.2 +++ b/indra/llmessage/llproxy.cpp	Tue May 08 18:31:13 2018 +0200
    35.3 @@ -48,7 +48,6 @@
    35.4  
    35.5  LLProxy::LLProxy():
    35.6  		mHTTPProxyEnabled(false),
    35.7 -		mProxyMutex(NULL),
    35.8  		mUDPProxy(),
    35.9  		mTCPProxy(),
   35.10  		mHTTPProxy(),
    36.1 --- a/indra/llmessage/llproxy.h	Tue May 01 16:45:50 2018 +0200
    36.2 +++ b/indra/llmessage/llproxy.h	Tue May 08 18:31:13 2018 +0200
    36.3 @@ -298,7 +298,7 @@
    36.4  private:
    36.5  	// Is the HTTP proxy enabled? Safe to read in any thread, but do not write directly.
    36.6  	// Instead use enableHTTPProxy() and disableHTTPProxy() instead.
    36.7 -	mutable LLAtomic32<bool> mHTTPProxyEnabled;
    36.8 +	mutable LLAtomicBool mHTTPProxyEnabled;
    36.9  
   36.10  	// Mutex to protect shared members in non-main thread calls to applyProxySettings().
   36.11  	mutable LLMutex mProxyMutex;
    37.1 --- a/indra/llmessage/llpumpio.h	Tue May 01 16:45:50 2018 +0200
    37.2 +++ b/indra/llmessage/llpumpio.h	Tue May 08 18:31:13 2018 +0200
    37.3 @@ -394,8 +394,8 @@
    37.4  	S32 mCurrentPoolReallocCount;
    37.5  
    37.6  #if LL_THREADS_APR
    37.7 -	apr_thread_mutex_t* mChainsMutex;
    37.8 -	apr_thread_mutex_t* mCallbackMutex;
    37.9 +	std::mutex* mChainsMutex;
   37.10 +	std::mutex* mCallbackMutex;
   37.11  #else
   37.12  	int* mChainsMutex;
   37.13  	int* mCallbackMutex;
    38.1 --- a/indra/llmessage/partsyspacket.cpp	Tue May 01 16:45:50 2018 +0200
    38.2 +++ b/indra/llmessage/partsyspacket.cpp	Tue May 08 18:31:13 2018 +0200
    38.3 @@ -574,7 +574,7 @@
    38.4  
    38.5  	mData[startByte++] = 0x00; // flag for "read whole UUID"
    38.6  
    38.7 -	memcpy(bufPtr, in->mImageUuid.mData, 16);		/* Flawfinder: ignore */
    38.8 +	memcpy( bufPtr, in->mImageUuid.mData, UUID_BYTES );		/* Flawfinder: ignore */
    38.9  	return (startByte+16);
   38.10  }
   38.11  
   38.12 @@ -936,8 +936,8 @@
   38.13  	}
   38.14  
   38.15  	startByte++; // cause we actually have to read the UUID now.
   38.16 -	memcpy(in->mImageUuid.mData, bufPtr, 16);		/* Flawfinder: ignore */
   38.17 -	return (startByte+16);
   38.18 +	memcpy( in->mImageUuid.mData, bufPtr, UUID_BYTES );		/* Flawfinder: ignore */
   38.19 +	return (startByte + UUID_BYTES);
   38.20  }
   38.21  
   38.22  
    39.1 --- a/indra/llplugin/llpluginmessagepipe.cpp	Tue May 01 16:45:50 2018 +0200
    39.2 +++ b/indra/llplugin/llpluginmessagepipe.cpp	Tue May 08 18:31:13 2018 +0200
    39.3 @@ -92,8 +92,6 @@
    39.4  }
    39.5  
    39.6  LLPluginMessagePipe::LLPluginMessagePipe(LLPluginMessagePipeOwner *owner, LLSocket::ptr_t socket):
    39.7 -	mInputMutex(gAPRPoolp),
    39.8 -	mOutputMutex(gAPRPoolp),
    39.9  	mOutputStartIndex(0),
   39.10  	mOwner(owner),
   39.11  	mSocket(socket)
    40.1 --- a/indra/llplugin/llpluginprocessparent.cpp	Tue May 01 16:45:50 2018 +0200
    40.2 +++ b/indra/llplugin/llpluginprocessparent.cpp	Tue May 08 18:31:13 2018 +0200
    40.3 @@ -81,12 +81,11 @@
    40.4  
    40.5  };
    40.6  
    40.7 -LLPluginProcessParent::LLPluginProcessParent(LLPluginProcessParentOwner *owner):
    40.8 -	mIncomingQueueMutex(gAPRPoolp)
    40.9 +LLPluginProcessParent::LLPluginProcessParent(LLPluginProcessParentOwner *owner)
   40.10  {
   40.11  	if(!sInstancesMutex)
   40.12  	{
   40.13 -		sInstancesMutex = new LLMutex(gAPRPoolp);
   40.14 +		sInstancesMutex = new LLMutex();
   40.15  	}
   40.16  	
   40.17  	mOwner = owner;
    41.1 --- a/indra/llplugin/slplugin/slplugin.cpp	Tue May 01 16:45:50 2018 +0200
    41.2 +++ b/indra/llplugin/slplugin/slplugin.cpp	Tue May 08 18:31:13 2018 +0200
    41.3 @@ -155,7 +155,6 @@
    41.4  int main(int argc, char **argv)
    41.5  #endif
    41.6  {
    41.7 -
    41.8  	ll_init_apr();
    41.9  
   41.10  	// Set up llerror logging
    42.1 --- a/indra/llprimitive/llmodel.cpp	Tue May 01 16:45:50 2018 +0200
    42.2 +++ b/indra/llprimitive/llmodel.cpp	Tue May 08 18:31:13 2018 +0200
    42.3 @@ -1163,7 +1163,7 @@
    42.4  
    42.5  	const S32 MODEL_LODS = 5;
    42.6  
    42.7 -	S32 lod = llclamp((S32) mDetail, 0, MODEL_LODS);
    42.8 +	S32 lod = llclamp((S32) mDetail, 0, MODEL_LODS-1);
    42.9  
   42.10  	if (header[lod_name[lod]]["offset"].asInteger() == -1 || 
   42.11  		header[lod_name[lod]]["size"].asInteger() == 0 )
    43.1 --- a/indra/llprimitive/llprimitive.cpp	Tue May 01 16:45:50 2018 +0200
    43.2 +++ b/indra/llprimitive/llprimitive.cpp	Tue May 08 18:31:13 2018 +0200
    43.3 @@ -227,6 +227,11 @@
    43.4  	return mTextureList.getTexture(index);
    43.5  }
    43.6  
    43.7 +LLTextureEntry& LLPrimitive::getTEref( const U8 te_num ) const
    43.8 +{
    43.9 +	return mTextureList.getTextureRef( te_num );
   43.10 +}
   43.11 +
   43.12  //===============================================================
   43.13  void LLPrimitive::setNumTEs(const U8 num_tes)
   43.14  {
   43.15 @@ -721,7 +726,7 @@
   43.16  	}
   43.17  	for (i = 0; i < num_tes; i++)
   43.18  	{
   43.19 -		mTextureList.copyTexture(i, *(primitivep->getTE(i)));
   43.20 +		mTextureList.copyTexture(i, primitivep->getTEref(i));
   43.21  	}
   43.22  }
   43.23  
   43.24 @@ -813,7 +818,7 @@
   43.25  		if (old_face_mask & cur_mask)
   43.26  		{
   43.27  			S32 te_index = face_index_from_id(cur_mask, old_faces);
   43.28 -			old_tes.copyTexture(face_bit, *(getTE(te_index)));
   43.29 +			old_tes.copyTexture(face_bit, getTEref(te_index));
   43.30  			//LL_INFOS() << face_bit << ":" << te_index << ":" << old_tes[face_bit].getID() << LL_ENDL;
   43.31  		}
   43.32  	}
   43.33 @@ -1140,11 +1145,13 @@
   43.34  		LLColor4U coloru;
   43.35  		for (face_index = 0; face_index <= last_face_index; face_index++)
   43.36  		{
   43.37 +			const LLTextureEntry &te = getTEref( face_index );
   43.38 +
   43.39  			// Directly sending image_ids is not safe!
   43.40 -			memcpy(&image_ids[face_index*16],getTE(face_index)->getID().mData,16);	/* Flawfinder: ignore */ 
   43.41 +			memcpy( &image_ids[ face_index*UUID_BYTES ], te.getID().mData, UUID_BYTES );	/* Flawfinder: ignore */
   43.42  
   43.43  			// Cast LLColor4 to LLColor4U
   43.44 -			coloru.setVec( getTE(face_index)->getColor() );
   43.45 +			coloru.setVec( te.getColor() );
   43.46  
   43.47  			// Note:  This is an optimization to send common colors (1.f, 1.f, 1.f, 1.f)
   43.48  			// as all zeros.  However, the subtraction and addition must be done in unsigned
   43.49 @@ -1154,18 +1161,17 @@
   43.50  			colors[4*face_index + 2] = 255 - coloru.mV[2];
   43.51  			colors[4*face_index + 3] = 255 - coloru.mV[3];
   43.52  
   43.53 -			const LLTextureEntry* te = getTE(face_index);
   43.54 -			scale_s[face_index] = (F32) te->mScaleS;
   43.55 -			scale_t[face_index] = (F32) te->mScaleT;
   43.56 -			offset_s[face_index] = (S16) ll_round((llclamp(te->mOffsetS,-1.0f,1.0f) * (F32)0x7FFF)) ;
   43.57 -			offset_t[face_index] = (S16) ll_round((llclamp(te->mOffsetT,-1.0f,1.0f) * (F32)0x7FFF)) ;
   43.58 -			image_rot[face_index] = (S16) ll_round(((fmod(te->mRotation, F_TWO_PI)/F_TWO_PI) * TEXTURE_ROTATION_PACK_FACTOR));
   43.59 -			bump[face_index] = te->getBumpShinyFullbright();
   43.60 -			media_flags[face_index] = te->getMediaTexGen();
   43.61 -			glow[face_index] = (U8) ll_round((llclamp(te->getGlow(), 0.0f, 1.0f) * (F32)0xFF));
   43.62 +			scale_s[face_index] = (F32) te.mScaleS;
   43.63 +			scale_t[face_index] = (F32) te.mScaleT;
   43.64 +			offset_s[face_index] = (S16) ll_round((llclamp(te.mOffsetS,-1.0f,1.0f) * (F32)0x7FFF)) ;
   43.65 +			offset_t[face_index] = (S16) ll_round((llclamp(te.mOffsetT,-1.0f,1.0f) * (F32)0x7FFF)) ;
   43.66 +			image_rot[face_index] = (S16) ll_round(((fmod(te.mRotation, F_TWO_PI)/F_TWO_PI) * TEXTURE_ROTATION_PACK_FACTOR));
   43.67 +			bump[face_index] = te.getBumpShinyFullbright();
   43.68 +			media_flags[face_index] = te.getMediaTexGen();
   43.69 +			glow[face_index] = (U8) ll_round((llclamp(te.getGlow(), 0.0f, 1.0f) * (F32)0xFF));
   43.70  
   43.71  			// Directly sending material_ids is not safe!
   43.72 -			memcpy(&material_data[face_index*16],getTE(face_index)->getMaterialID().get(),16);	/* Flawfinder: ignore */ 
   43.73 +			memcpy( &material_data[ face_index * UUID_BYTES ], te.getMaterialID().get(), UUID_BYTES );	/* Flawfinder: ignore */
   43.74  		}
   43.75  
   43.76  		cur_ptr += packTEField(cur_ptr, (U8 *)image_ids, sizeof(LLUUID),last_face_index, MVT_LLUUID);
   43.77 @@ -1225,11 +1231,12 @@
   43.78  		LLColor4U coloru;
   43.79  		for (face_index = 0; face_index <= last_face_index; face_index++)
   43.80  		{
   43.81 +			const LLTextureEntry &te = getTEref( face_index );
   43.82  			// Directly sending image_ids is not safe!
   43.83 -			memcpy(&image_ids[face_index*16],getTE(face_index)->getID().mData,16);	/* Flawfinder: ignore */ 
   43.84 +			memcpy( &image_ids[ face_index*UUID_BYTES ], te.getID().mData, UUID_BYTES );	/* Flawfinder: ignore */
   43.85  
   43.86  			// Cast LLColor4 to LLColor4U
   43.87 -			coloru.setVec( getTE(face_index)->getColor() );
   43.88 +			coloru.setVec( te.getColor() );
   43.89  
   43.90  			// Note:  This is an optimization to send common colors (1.f, 1.f, 1.f, 1.f)
   43.91  			// as all zeros.  However, the subtraction and addition must be done in unsigned
   43.92 @@ -1239,18 +1246,17 @@
   43.93  			colors[4*face_index + 2] = 255 - coloru.mV[2];
   43.94  			colors[4*face_index + 3] = 255 - coloru.mV[3];
   43.95  
   43.96 -			const LLTextureEntry* te = getTE(face_index);
   43.97 -			scale_s[face_index] = (F32) te->mScaleS;
   43.98 -			scale_t[face_index] = (F32) te->mScaleT;
   43.99 -			offset_s[face_index] = (S16) ll_round((llclamp(te->mOffsetS,-1.0f,1.0f) * (F32)0x7FFF)) ;
  43.100 -			offset_t[face_index] = (S16) ll_round((llclamp(te->mOffsetT,-1.0f,1.0f) * (F32)0x7FFF)) ;
  43.101 -			image_rot[face_index] = (S16) ll_round(((fmod(te->mRotation, F_TWO_PI)/F_TWO_PI) * TEXTURE_ROTATION_PACK_FACTOR));
  43.102 -			bump[face_index] = te->getBumpShinyFullbright();
  43.103 -			media_flags[face_index] = te->getMediaTexGen();
  43.104 -            glow[face_index] = (U8) ll_round((llclamp(te->getGlow(), 0.0f, 1.0f) * (F32)0xFF));
  43.105 +			scale_s[face_index] = (F32) te.mScaleS;
  43.106 +			scale_t[face_index] = (F32) te.mScaleT;
  43.107 +			offset_s[face_index] = (S16) ll_round((llclamp(te.mOffsetS,-1.0f,1.0f) * (F32)0x7FFF)) ;
  43.108 +			offset_t[face_index] = (S16) ll_round((llclamp(te.mOffsetT,-1.0f,1.0f) * (F32)0x7FFF)) ;
  43.109 +			image_rot[face_index] = (S16) ll_round(((fmod(te.mRotation, F_TWO_PI)/F_TWO_PI) * TEXTURE_ROTATION_PACK_FACTOR));
  43.110 +			bump[face_index] = te.getBumpShinyFullbright();
  43.111 +			media_flags[face_index] = te.getMediaTexGen();
  43.112 +            glow[face_index] = (U8) ll_round((llclamp(te.getGlow(), 0.0f, 1.0f) * (F32)0xFF));
  43.113  
  43.114  			// Directly sending material_ids is not safe!
  43.115 -			memcpy(&material_data[face_index*16],getTE(face_index)->getMaterialID().get(),16);	/* Flawfinder: ignore */ 
  43.116 +			memcpy( &material_data[ face_index*UUID_BYTES ], te.getMaterialID().get(), UUID_BYTES );	/* Flawfinder: ignore */
  43.117  		}
  43.118  
  43.119  		cur_ptr += packTEField(cur_ptr, (U8 *)image_ids, sizeof(LLUUID),last_face_index, MVT_LLUUID);
  43.120 @@ -1472,8 +1478,8 @@
  43.121  
  43.122  	for (i = 0; i < face_count; i++)
  43.123  	{
  43.124 -		memcpy(image_ids[i].mData,&image_data[i*16],16);	/* Flawfinder: ignore */ 	
  43.125 -		material_ids[i].set(&material_data[i * 16]);
  43.126 +		memcpy( image_ids[ i ].mData, &image_data[ i*UUID_BYTES ], UUID_BYTES );	/* Flawfinder: ignore */
  43.127 +		material_ids[ i ].set( &material_data[ i * UUID_BYTES ] );
  43.128  	}
  43.129  	
  43.130  	LLColor4 color;
    44.1 --- a/indra/llprimitive/llprimitive.h	Tue May 01 16:45:50 2018 +0200
    44.2 +++ b/indra/llprimitive/llprimitive.h	Tue May 08 18:31:13 2018 +0200
    44.3 @@ -365,7 +365,8 @@
    44.4  	
    44.5  	// Modify texture entry properties
    44.6  	inline BOOL validTE(const U8 te_num) const;
    44.7 -	LLTextureEntry* getTE(const U8 te_num) const;
    44.8 +	LLTextureEntry* getTE( const U8 te_num ) const;
    44.9 +	LLTextureEntry& getTEref( const U8 te_num ) const;
   44.10  
   44.11  	virtual void setNumTEs(const U8 num_tes);
   44.12  	virtual void setAllTESelected(bool sel);
    45.1 --- a/indra/llprimitive/llprimtexturelist.cpp	Tue May 01 16:45:50 2018 +0200
    45.2 +++ b/indra/llprimitive/llprimtexturelist.cpp	Tue May 08 18:31:13 2018 +0200
    45.3 @@ -137,22 +137,8 @@
    45.4  		// we're changing an existing entry
    45.5  	llassert(mEntryList[index]);
    45.6  	delete (mEntryList[index]);
    45.7 +	mEntryList[index] = te.newCopy();
    45.8  
    45.9 -	//<FS:ND> The compiler will assume te being valid as it is passed by reference and thus else will never be executed.
   45.10 -	// If someone really passed *nullptr in here, this will be undefined behaviour
   45.11 -	
   45.12 -	// if  (&te)
   45.13 -	// {
   45.14 -	// 	mEntryList[index] = te.newCopy();
   45.15 -	// }
   45.16 -	// else
   45.17 -	// {
   45.18 -	// 	mEntryList[index] = LLPrimTextureList::newTextureEntry();
   45.19 -	// }
   45.20 -
   45.21 -	mEntryList[index] = te.newCopy();
   45.22 -	// </FS:ND>
   45.23 -	
   45.24  	return TEM_CHANGE_TEXTURE;
   45.25  }
   45.26  
   45.27 @@ -184,6 +170,17 @@
   45.28  	return NULL;
   45.29  }
   45.30  
   45.31 +LLTextureEntry& LLPrimTextureList::getTextureRef( const U8 index ) const
   45.32 +{
   45.33 +	if( index >= mEntryList.size() )
   45.34 +	{
   45.35 +		LL_ERRS() << "Texture index out of bounds, index: " << (U32)index << " mEntryList.size(): " << mEntryList.size() << LL_ENDL;
   45.36 +	}
   45.37 +
   45.38 +	return *mEntryList[ index ];
   45.39 +}
   45.40 +
   45.41 +
   45.42  //virtual 
   45.43  //S32 setTE(const U8 index, const LLTextureEntry& te) = 0;
   45.44  
    46.1 --- a/indra/llprimitive/llprimtexturelist.h	Tue May 01 16:45:50 2018 +0200
    46.2 +++ b/indra/llprimitive/llprimtexturelist.h	Tue May 08 18:31:13 2018 +0200
    46.3 @@ -82,7 +82,8 @@
    46.4  //	void copyTexture(const U8 index, const LLTextureEntry* entry);
    46.5  
    46.6  	// returns pointer to texture at 'index' slot
    46.7 -	LLTextureEntry* getTexture(const U8 index) const;
    46.8 +	LLTextureEntry* getTexture( const U8 index ) const;
    46.9 +	LLTextureEntry& getTextureRef( const U8 index ) const;
   46.10  
   46.11  	S32 setID(const U8 index, const LLUUID& id);
   46.12  	S32 setColor(const U8 index, const LLColor3& color);
    47.1 --- a/indra/llvfs/llvfs.cpp	Tue May 01 16:45:50 2018 +0200
    47.2 +++ b/indra/llvfs/llvfs.cpp	Tue May 08 18:31:13 2018 +0200
    47.3 @@ -234,7 +234,7 @@
    47.4  	mDataFP(NULL),
    47.5  	mIndexFP(NULL)
    47.6  {
    47.7 -	mDataMutex = new LLMutex(0);
    47.8 +	mDataMutex = new LLMutex();
    47.9  
   47.10  	S32 i;
   47.11  	for (i = 0; i < VFSLOCK_COUNT; i++)
    48.1 --- a/indra/media_plugins/cef/media_plugin_cef.cpp	Tue May 01 16:45:50 2018 +0200
    48.2 +++ b/indra/media_plugins/cef/media_plugin_cef.cpp	Tue May 08 18:31:13 2018 +0200
    48.3 @@ -119,6 +119,9 @@
    48.4  	mPluginsEnabled = false;
    48.5  	mJavascriptEnabled = true;
    48.6  	mDisableGPU = false;
    48.7 +#ifdef LL_LINUX // <FS:ND> Do not use GPU on Linux, using GPU messes with some window managers (https://bitbucket.org/NickyD/phoenix-firestorm-lgpl-linux/commits/14c936db5a02cf0f3ff24eb7f1c92136#comment-6048984)
    48.8 +	mDisableGPU = true;
    48.9 +#endif
   48.10  	mUserAgentSubtring = "";
   48.11  	mAuthUsername = "";
   48.12  	mAuthPassword = "";
    49.1 --- a/indra/newview/app_settings/settings.xml	Tue May 01 16:45:50 2018 +0200
    49.2 +++ b/indra/newview/app_settings/settings.xml	Tue May 08 18:31:13 2018 +0200
    49.3 @@ -16,7 +16,7 @@
    49.4    <key>FSEnforceStrictObjectCheck</key>
    49.5    <map>
    49.6      <key>Comment</key>
    49.7 -    <string>Force malformed prims to be treated as invalid. This setting derenders all malformed prims, even those that might not cause obvious issues. Setting to false will allow bad prims to render but can cause crashes.</string>
    49.8 +    <string>Force malformed prims to be treated as invalid. This setting derenders all malformed prims, even those that might not cause obvious issues. Setting to false will allow bad prims to render but can cause crashes. (Disabled on OpenSim)</string>
    49.9      <key>Persist</key>
   49.10      <integer>1</integer>
   49.11      <key>Type</key>
    50.1 --- a/indra/newview/fspanelprefs.cpp	Tue May 01 16:45:50 2018 +0200
    50.2 +++ b/indra/newview/fspanelprefs.cpp	Tue May 08 18:31:13 2018 +0200
    50.3 @@ -35,7 +35,7 @@
    50.4  #include "llagent.h"
    50.5  #include "llcheckboxctrl.h"
    50.6  #include "llcombobox.h"
    50.7 -#include "lldiriterator.h"	// <FS:CR> for populating the cloud combo
    50.8 +#include "lldiriterator.h"
    50.9  #include "llfloaterreg.h"
   50.10  #include "llinventorymodel.h"
   50.11  #include "llstartup.h"
   50.12 @@ -47,7 +47,7 @@
   50.13  FSPanelPrefs::FSPanelPrefs() : LLPanelPreference()
   50.14  {
   50.15  	mCommitCallbackRegistrar.add("Perms.Copy",	boost::bind(&FSPanelPrefs::onCommitCopy, this));
   50.16 -	mCommitCallbackRegistrar.add("Perms.Trans", boost::bind(&FSPanelPrefs::onCommitTrans, this));
   50.17 +	mCommitCallbackRegistrar.add("Perms.Trans",	boost::bind(&FSPanelPrefs::onCommitTrans, this));
   50.18  
   50.19  	mEmbeddedItem = gSavedPerAccountSettings.getString("FSBuildPrefs_Item");
   50.20  }
   50.21 @@ -67,6 +67,8 @@
   50.22  	getChild<LLUICtrl>("refresh_beams")->setCommitCallback(boost::bind(&FSPanelPrefs::refreshBeamLists, this));
   50.23  	getChild<LLUICtrl>("delete_beam")->setCommitCallback(boost::bind(&FSPanelPrefs::onBeamDelete, this));
   50.24  
   50.25 +	getChild<LLUICtrl>("reset_default_folders")->setCommitCallback(boost::bind(&FSPanelPrefs::onResetDefaultFolders, this));
   50.26 +
   50.27  	populateCloudCombo();
   50.28  	
   50.29  	LLTextureCtrl* tex_ctrl = getChild<LLTextureCtrl>("texture control");
   50.30 @@ -102,11 +104,13 @@
   50.31  				getChild<LLTextBox>("build_item_add_disp_rect_txt")->setTextArg("[ITEM]", getString("EmbeddedItemNotAvailable"));
   50.32  			}
   50.33  		}
   50.34 +		getChild<LLUICtrl>("reset_default_folders")->setEnabled(TRUE);
   50.35  	}
   50.36  	else
   50.37  	{
   50.38  		getChild<LLCheckBoxCtrl>("FSBuildPrefs_EmbedItem")->setEnabled(FALSE);
   50.39  		getChild<LLTextBox>("build_item_add_disp_rect_txt")->setTextArg("[ITEM]", getString("EmbeddedItemNotLoggedIn"));
   50.40 +		getChild<LLUICtrl>("reset_default_folders")->setEnabled(FALSE);
   50.41  	}
   50.42  }
   50.43  
   50.44 @@ -120,13 +124,11 @@
   50.45  	}
   50.46  }
   50.47  
   50.48 -
   50.49  void FSPanelPrefs::cancel()
   50.50  {
   50.51  	LLPanelPreference::cancel();
   50.52  }
   50.53  
   50.54 -
   50.55  void FSPanelPrefs::refreshBeamLists()
   50.56  {
   50.57  	static const std::string off_label = getString("BeamsOffLabel");
   50.58 @@ -239,13 +241,9 @@
   50.59  
   50.60  void FSPanelPrefs::onCommitTexture(const LLSD& data)
   50.61  {
   50.62 -	LLTextureCtrl* texture_ctrl = getChild<LLTextureCtrl>("texture control");
   50.63 -	if (!texture_ctrl)
   50.64 -	{
   50.65 -		return;
   50.66 -	}
   50.67 +	LLTextureCtrl* texture_ctrl = findChild<LLTextureCtrl>("texture control");
   50.68  
   50.69 -	if (!texture_ctrl->getTentative())
   50.70 +	if (texture_ctrl && !texture_ctrl->getTentative())
   50.71  	{
   50.72  		// we grab the item id first, because we want to do a
   50.73  		// permissions check
   50.74 @@ -258,7 +256,7 @@
   50.75  		// Texture picker defaults aren't inventory items
   50.76  		// * Don't need to worry about permissions for them
   50.77  		LLViewerInventoryItem* item = gInventory.getItem(id);
   50.78 -		if (item && !item->getPermissions().allowOperationBy(PERM_COPY, gAgent.getID()))
   50.79 +		if (item && !item->getPermissions().allowOperationBy(PERM_COPY, gAgentID))
   50.80  		{
   50.81  			// Do not have permission to copy the texture.
   50.82  			return;
   50.83 @@ -299,3 +297,10 @@
   50.84  	}
   50.85  }
   50.86  
   50.87 +void FSPanelPrefs::onResetDefaultFolders()
   50.88 +{
   50.89 +	gSavedPerAccountSettings.getControl("ModelUploadFolder")->resetToDefault(true);
   50.90 +	gSavedPerAccountSettings.getControl("TextureUploadFolder")->resetToDefault(true);
   50.91 +	gSavedPerAccountSettings.getControl("SoundUploadFolder")->resetToDefault(true);
   50.92 +	gSavedPerAccountSettings.getControl("AnimationUploadFolder")->resetToDefault(true);
   50.93 +}
    51.1 --- a/indra/newview/fspanelprefs.h	Tue May 01 16:45:50 2018 +0200
    51.2 +++ b/indra/newview/fspanelprefs.h	Tue May 08 18:31:13 2018 +0200
    51.3 @@ -58,6 +58,8 @@
    51.4  
    51.5  	void onDADEmbeddedItem(const LLUUID& item_id);
    51.6  
    51.7 +	void onResetDefaultFolders();
    51.8 +
    51.9  	FSEmbeddedItemDropTarget*	mInvDropTarget;
   51.10  	std::string					mEmbeddedItem;
   51.11  };
    52.1 --- a/indra/newview/fsradarmenu.cpp	Tue May 01 16:45:50 2018 +0200
    52.2 +++ b/indra/newview/fsradarmenu.cpp	Tue May 08 18:31:13 2018 +0200
    52.3 @@ -31,6 +31,7 @@
    52.4  #include "llmenugl.h"
    52.5  
    52.6  #include "fsradarmenu.h"
    52.7 +#include "fsavatarrenderpersistence.h"
    52.8  
    52.9  // newview
   52.10  #include "llagent.h"
   52.11 @@ -83,6 +84,7 @@
   52.12  		registrar.add("Avatar.AddToContactSet",					boost::bind(&FSRadarMenu::addToContactSet,					this));
   52.13  		registrar.add("Nearby.People.TeleportToAvatar",			boost::bind(&FSRadarMenu::teleportToAvatar,					this));
   52.14  		registrar.add("Nearby.People.TrackAvatar",				boost::bind(&FSRadarMenu::onTrackAvatarMenuItemClick,		this));
   52.15 +		registrar.add("Nearby.People.SetRenderMode",			boost::bind(&FSRadarMenu::onSetRenderMode,					this, _2));
   52.16  		registrar.add("Nearby.People.SetAvatarMarkColor",		boost::bind(&LLNetMap::setAvatarMarkColor,					id, _2));
   52.17  		registrar.add("Nearby.People.ClearAvatarMarkColor",		boost::bind(&LLNetMap::clearAvatarMarkColor,				id));
   52.18  		registrar.add("Nearby.People.ClearAllAvatarMarkColors",	boost::bind(&LLNetMap::clearAvatarMarkColors				));
   52.19 @@ -92,6 +94,7 @@
   52.20  		enable_registrar.add("Avatar.VisibleZoomIn",			boost::bind(&LLAvatarActions::canZoomIn,					id));
   52.21  		enable_registrar.add("Avatar.VisibleFreezeEject",		boost::bind(&LLAvatarActions::canLandFreezeOrEject,			id));
   52.22  		enable_registrar.add("Avatar.VisibleKickTeleportHome",	boost::bind(&LLAvatarActions::canEstateKickOrTeleportHome,	id));
   52.23 +		enable_registrar.add("Nearby.People.CheckRenderMode",	boost::bind(&FSRadarMenu::checkSetRenderMode,				this, _2));
   52.24  
   52.25  		// create the context menu from the XUI
   52.26  		return createFromFile("menu_fs_radar.xml");
   52.27 @@ -120,6 +123,7 @@
   52.28  		registrar.add("Avatar.Derender",						boost::bind(&LLAvatarActions::derenderMultiple,						mUUIDs, false));
   52.29  		registrar.add("Avatar.DerenderPermanent",				boost::bind(&LLAvatarActions::derenderMultiple,						mUUIDs, true));
   52.30  		registrar.add("Avatar.AddToContactSet",					boost::bind(&FSRadarMenu::addToContactSet,							this));
   52.31 +		registrar.add("Nearby.People.SetRenderMode",			boost::bind(&FSRadarMenu::onSetRenderMode,							this, _2));
   52.32  		registrar.add("Nearby.People.SetAvatarMarkColor",		boost::bind(&LLNetMap::setAvatarMarkColors,							mUUIDs, _2));
   52.33  		registrar.add("Nearby.People.ClearAvatarMarkColor",		boost::bind(&LLNetMap::clearAvatarMarkColors,						mUUIDs));
   52.34  		registrar.add("Nearby.People.ClearAllAvatarMarkColors",	boost::bind(&LLNetMap::clearAvatarMarkColors						));
   52.35 @@ -264,4 +268,71 @@
   52.36  {
   52.37  	LLAvatarActions::addToContactSet(mUUIDs);
   52.38  }
   52.39 +
   52.40 +void FSRadarMenu::onSetRenderMode(const LLSD& userdata)
   52.41 +{
   52.42 +	LLVOAvatar::VisualMuteSettings render_setting;
   52.43 +	U32 mode = userdata.asInteger();
   52.44 +	switch (mode)
   52.45 +	{
   52.46 +		case 0:
   52.47 +			render_setting = LLVOAvatar::AV_RENDER_NORMALLY;
   52.48 +			break;
   52.49 +		case 1:
   52.50 +			render_setting = LLVOAvatar::AV_DO_NOT_RENDER;
   52.51 +			break;
   52.52 +		case 2:
   52.53 +			render_setting = LLVOAvatar::AV_ALWAYS_RENDER;
   52.54 +			break;
   52.55 +		default:
   52.56 +			LL_WARNS() << "Unknown value for visual mute settings: " << mode << LL_ENDL;
   52.57 +			return;
   52.58 +	}
   52.59 +
   52.60 +	bool needs_culling = false;
   52.61 +	for (uuid_vec_t::const_iterator it = mUUIDs.begin(); it != mUUIDs.end(); ++it)
   52.62 +	{
   52.63 +		const LLUUID& avatar_id = *it;
   52.64 +
   52.65 +		LLVOAvatar *avatarp = dynamic_cast<LLVOAvatar*>(gObjectList.findObject(avatar_id));
   52.66 +		if (avatarp)
   52.67 +		{
   52.68 +			avatarp->setVisualMuteSettings(render_setting);
   52.69 +			needs_culling = true;
   52.70 +		}
   52.71 +		else
   52.72 +		{
   52.73 +			FSAvatarRenderPersistence::instance().setAvatarRenderSettings(avatar_id, render_setting);
   52.74 +		}
   52.75 +	}
   52.76 +
   52.77 +	if (needs_culling)
   52.78 +	{
   52.79 +		LLVOAvatar::cullAvatarsByPixelArea();
   52.80 +	}
   52.81 +}
   52.82 +
   52.83 +bool FSRadarMenu::checkSetRenderMode(const LLSD& userdata)
   52.84 +{
   52.85 +	LLVOAvatar::VisualMuteSettings render_setting;
   52.86 +	U32 mode = userdata.asInteger();
   52.87 +	switch (mode)
   52.88 +	{
   52.89 +		case 0:
   52.90 +			render_setting = LLVOAvatar::AV_RENDER_NORMALLY;
   52.91 +			break;
   52.92 +		case 1:
   52.93 +			render_setting = LLVOAvatar::AV_DO_NOT_RENDER;
   52.94 +			break;
   52.95 +		case 2:
   52.96 +			render_setting = LLVOAvatar::AV_ALWAYS_RENDER;
   52.97 +			break;
   52.98 +		default:
   52.99 +			LL_WARNS() << "Unknown value for visual mute settings: " << mode << LL_ENDL;
  52.100 +			return false;
  52.101 +	}
  52.102 +
  52.103 +	return FSAvatarRenderPersistence::instance().getAvatarRenderSettings(mUUIDs.front()) == render_setting;
  52.104 +}
  52.105 +
  52.106  } // namespace FSFloaterRadarMenu
    53.1 --- a/indra/newview/fsradarmenu.h	Tue May 01 16:45:50 2018 +0200
    53.2 +++ b/indra/newview/fsradarmenu.h	Tue May 08 18:31:13 2018 +0200
    53.3 @@ -47,6 +47,8 @@
    53.4  	void teleportToAvatar();
    53.5  	void onTrackAvatarMenuItemClick();
    53.6  	void addToContactSet();
    53.7 +	void onSetRenderMode(const LLSD& userdata);
    53.8 +	bool checkSetRenderMode(const LLSD& userdata);
    53.9  };
   53.10  
   53.11  extern FSRadarMenu gFSRadarMenu;
    54.1 --- a/indra/newview/llappviewer.cpp	Tue May 01 16:45:50 2018 +0200
    54.2 +++ b/indra/newview/llappviewer.cpp	Tue May 08 18:31:13 2018 +0200
    54.3 @@ -2525,7 +2525,7 @@
    54.4  
    54.5  	if (LLTrace::BlockTimer::sLog || LLTrace::BlockTimer::sMetricLog)
    54.6  	{
    54.7 -		LLTrace::BlockTimer::setLogLock(new LLMutex(NULL));
    54.8 +		LLTrace::BlockTimer::setLogLock(new LLMutex());
    54.9  		mFastTimerLogThread = new LLFastTimerLogThread(LLTrace::BlockTimer::sLogName);
   54.10  		mFastTimerLogThread->start();
   54.11  	}
    55.1 --- a/indra/newview/llface.cpp	Tue May 01 16:45:50 2018 +0200
    55.2 +++ b/indra/newview/llface.cpp	Tue May 08 18:31:13 2018 +0200
    55.3 @@ -1031,18 +1031,23 @@
    55.4  	}
    55.5  
    55.6  	const LLVolumeFace& vf = getViewerObject()->getVolume()->getVolumeFace(mTEOffset);
    55.7 +
    55.8 +	if( !vf.mNormals )
    55.9 +	{
   55.10 +		LL_WARNS( ) << "Volume face without normal vector (object id: " << getViewerObject()->getID().asString() << ")" << LL_ENDL;
   55.11 +		return;
   55.12 +	}
   55.13 +
   55.14 +
   55.15 +	if( !vf.mTangents )
   55.16 +	{
   55.17 +		LL_WARNS() << "Volume face without tangent (object id: " << getViewerObject()->getID().asString() << ")" << LL_ENDL;
   55.18 +		return;
   55.19 +	}
   55.20 +
   55.21  	const LLVector4a& normal4a = vf.mNormals[0];
   55.22  	const LLVector4a& tangent = vf.mTangents[0];
   55.23  
   55.24 -	// <FS:ND> tangent is a reference, compiler will always assume it's valid and skip the check due to tangent==nullptr being undefined behaviour.
   55.25 -
   55.26 -	// if (!&tangent)
   55.27 -	// {
   55.28 -	// 	return;
   55.29 -	// }
   55.30 -
   55.31 -	// </FS:ND>
   55.32 -
   55.33  	LLVector4a binormal4a;
   55.34  	binormal4a.setCross3(normal4a, tangent);
   55.35  	binormal4a.mul(tangent.getF32ptr()[3]);
    56.1 --- a/indra/newview/llfloateravatartextures.cpp	Tue May 01 16:45:50 2018 +0200
    56.2 +++ b/indra/newview/llfloateravatartextures.cpp	Tue May 08 18:31:13 2018 +0200
    56.3 @@ -104,7 +104,7 @@
    56.4  	}
    56.5  	else
    56.6  	{
    56.7 -		id = avatarp->getTE(te)->getID();
    56.8 +		id = avatarp->getTEref(te).getID();
    56.9  	}
   56.10  	//id = avatarp->getTE(te)->getID();
   56.11  	if (id == IMG_DEFAULT_AVATAR)
    57.1 --- a/indra/newview/llfloaterconversationpreview.cpp	Tue May 01 16:45:50 2018 +0200
    57.2 +++ b/indra/newview/llfloaterconversationpreview.cpp	Tue May 08 18:31:13 2018 +0200
    57.3 @@ -58,7 +58,6 @@
    57.4  	mPageSize(gSavedSettings.getS32("ConversationHistoryPageSize")),
    57.5  	mAccountName(session_id[LL_FCP_ACCOUNT_NAME]),
    57.6  	mCompleteName(session_id[LL_FCP_COMPLETE_NAME]),
    57.7 -	mMutex(NULL),
    57.8  	mShowHistory(false),
    57.9  	mMessages(NULL),
   57.10  	mHistoryThreadsBusy(false),
    58.1 --- a/indra/newview/llfloatermodelpreview.cpp	Tue May 01 16:45:50 2018 +0200
    58.2 +++ b/indra/newview/llfloatermodelpreview.cpp	Tue May 08 18:31:13 2018 +0200
    58.3 @@ -272,7 +272,7 @@
    58.4  	sInstance = this;
    58.5  	mLastMouseX = 0;
    58.6  	mLastMouseY = 0;
    58.7 -	mStatusLock = new LLMutex(NULL);
    58.8 +	mStatusLock = new LLMutex();
    58.9  	mModelPreview = NULL;
   58.10  
   58.11  	mLODMode[LLModel::LOD_HIGH] = 0;
   58.12 @@ -1273,7 +1273,7 @@
   58.13  //-----------------------------------------------------------------------------
   58.14  
   58.15  LLModelPreview::LLModelPreview(S32 width, S32 height, LLFloater* fmp)
   58.16 -: LLViewerDynamicTexture(width, height, 3, ORDER_MIDDLE, FALSE), LLMutex(NULL)
   58.17 +: LLViewerDynamicTexture(width, height, 3, ORDER_MIDDLE, FALSE)
   58.18  , mLodsQuery()
   58.19  , mLodsWithParsingError()
   58.20  , mPelvisZOffset( 0.0f )
    59.1 --- a/indra/newview/lllogchat.cpp	Tue May 01 16:45:50 2018 +0200
    59.2 +++ b/indra/newview/lllogchat.cpp	Tue May 08 18:31:13 2018 +0200
    59.3 @@ -603,7 +603,7 @@
    59.4  {
    59.5  	if (sHistoryThreadsMutex == NULL)
    59.6  	{
    59.7 -		sHistoryThreadsMutex = new LLMutex(NULL);
    59.8 +		sHistoryThreadsMutex = new LLMutex();
    59.9  	}
   59.10  	return sHistoryThreadsMutex;
   59.11  }
   59.12 @@ -1196,8 +1196,6 @@
   59.13  
   59.14  LLActionThread::LLActionThread(const std::string& name)
   59.15  	: LLThread(name),
   59.16 -	mMutex(NULL),
   59.17 -	mRunCondition(NULL),
   59.18  	mFinished(false)
   59.19  {
   59.20  }
    60.1 --- a/indra/newview/llmainlooprepeater.cpp	Tue May 01 16:45:50 2018 +0200
    60.2 +++ b/indra/newview/llmainlooprepeater.cpp	Tue May 08 18:31:13 2018 +0200
    60.3 @@ -46,7 +46,7 @@
    60.4  {
    60.5  	if(mQueue != 0) return;
    60.6  
    60.7 -	mQueue = new LLThreadSafeQueue<LLSD>(gAPRPoolp, 1024);
    60.8 +	mQueue = new LLThreadSafeQueue<LLSD>( 1024);
    60.9  	mMainLoopConnection = LLEventPumps::instance().
   60.10  		obtain("mainloop").listen(LLEventPump::inventName(), boost::bind(&LLMainLoopRepeater::onMainLoop, this, _1));
   60.11  	mRepeaterConnection = LLEventPumps::instance().
    61.1 --- a/indra/newview/llmeshrepository.cpp	Tue May 01 16:45:50 2018 +0200
    61.2 +++ b/indra/newview/llmeshrepository.cpp	Tue May 08 18:31:13 2018 +0200
    61.3 @@ -823,9 +823,9 @@
    61.4  {
    61.5  	LLAppCoreHttp & app_core_http(LLAppViewer::instance()->getAppCoreHttp());
    61.6  
    61.7 -	mMutex = new LLMutex(NULL);
    61.8 -	mHeaderMutex = new LLMutex(NULL);
    61.9 -	mSignal = new LLCondition(NULL);
   61.10 +	mMutex = new LLMutex();
   61.11 +	mHeaderMutex = new LLMutex();
   61.12 +	mSignal = new LLCondition();
   61.13  	mHttpRequest = new LLCore::HttpRequest;
   61.14  	mHttpOptions = LLCore::HttpOptions::ptr_t(new LLCore::HttpOptions);
   61.15  	mHttpOptions->setTransferTimeout(SMALL_MESH_XFER_TIMEOUT);
   61.16 @@ -2018,7 +2018,7 @@
   61.17  	mUploadSkin = upload_skin;
   61.18  	mUploadJoints = upload_joints;
   61.19      mLockScaleIfJointPosition = lock_scale_if_joint_position;
   61.20 -	mMutex = new LLMutex(NULL);
   61.21 +	mMutex = new LLMutex();
   61.22  	mPendingUploads = 0;
   61.23  	mFinished = false;
   61.24  	mOrigin = gAgent.getPositionAgent();
   61.25 @@ -3444,7 +3444,7 @@
   61.26  
   61.27  void LLMeshRepository::init()
   61.28  {
   61.29 -	mMeshMutex = new LLMutex(NULL);
   61.30 +	mMeshMutex = new LLMutex();
   61.31  	
   61.32  	LLConvexDecomposition::getInstance()->initSystem();
   61.33  
   61.34 @@ -4420,8 +4420,8 @@
   61.35  	mQuitting = false;
   61.36  	mDone = false;
   61.37  
   61.38 -	mSignal = new LLCondition(NULL);
   61.39 -	mMutex = new LLMutex(NULL);
   61.40 +	mSignal = new LLCondition();
   61.41 +	mMutex = new LLMutex();
   61.42  }
   61.43  
   61.44  LLPhysicsDecomp::~LLPhysicsDecomp()
    62.1 --- a/indra/newview/lloutfitslist.cpp	Tue May 01 16:45:50 2018 +0200
    62.2 +++ b/indra/newview/lloutfitslist.cpp	Tue May 08 18:31:13 2018 +0200
    62.3 @@ -53,6 +53,9 @@
    62.4  #include "lltextbox.h"
    62.5  #include "lleconomy.h"
    62.6  
    62.7 +#include "rlvactions.h"
    62.8 +#include "rlvlocks.h"
    62.9 +
   62.10  static bool is_tab_header_clicked(LLAccordionCtrlTab* tab, S32 y);
   62.11  
   62.12  static const LLOutfitTabNameComparator OUTFIT_TAB_NAME_COMPARATOR;
   62.13 @@ -155,6 +158,7 @@
   62.14      LLAccordionCtrlTab* tab = LLUICtrlFactory::create<LLAccordionCtrlTab>(tab_params);
   62.15      if (!tab) return;
   62.16      LLWearableItemsList* wearable_list = LLUICtrlFactory::create<LLWearableItemsList>(tab_params.wearable_list);
   62.17 +    wearable_list->setDoubleClickCallback(boost::bind(&LLOutfitsList::onDoubleClick, this, wearable_list)); // <FS:Ansariel> FIRE-22484: Double-click wear in outfits list
   62.18      wearable_list->setShape(tab->getLocalRect());
   62.19      tab->addChild(wearable_list);
   62.20  
   62.21 @@ -267,6 +271,48 @@
   62.22  }
   62.23  // </FS:Ansariel>
   62.24  
   62.25 +// <FS:Ansariel> FIRE-22484: Double-click wear in outfits list
   62.26 +void LLOutfitsList::onDoubleClick(LLWearableItemsList* list)
   62.27 +{
   62.28 +	if (!list)
   62.29 +	{
   62.30 +		return;
   62.31 +	}
   62.32 +
   62.33 +	LLUUID selected_item_id = list->getSelectedUUID();
   62.34 +	if (selected_item_id.notNull())
   62.35 +	{
   62.36 +		uuid_vec_t ids;
   62.37 +		ids.push_back(selected_item_id);
   62.38 +		LLViewerInventoryItem* item = gInventory.getItem(selected_item_id);
   62.39 +
   62.40 +		if (get_is_item_worn(selected_item_id))
   62.41 +		{
   62.42 +			if ((item->getType() == LLAssetType::AT_CLOTHING && (!RlvActions::isRlvEnabled() || gRlvWearableLocks.canRemove(item))) ||
   62.43 +			    ((item->getType() == LLAssetType::AT_OBJECT) && (!RlvActions::isRlvEnabled() || gRlvAttachmentLocks.canDetach(item))))
   62.44 +			{
   62.45 +				LLAppearanceMgr::instance().removeItemsFromAvatar(ids);
   62.46 +			}
   62.47 +		}
   62.48 +		else
   62.49 +		{
   62.50 +			if (item->getType() == LLAssetType::AT_BODYPART && (!RlvActions::isRlvEnabled() || (gRlvWearableLocks.canWear(item) & RLV_WEAR_REPLACE) == RLV_WEAR_REPLACE))
   62.51 +			{
   62.52 +				wear_multiple(ids, true);
   62.53 +			}
   62.54 +			else if (item->getType() == LLAssetType::AT_CLOTHING && LLAppearanceMgr::instance().canAddWearables(ids) && (!RlvActions::isRlvEnabled() || (gRlvWearableLocks.canWear(item) & RLV_WEAR_ADD) == RLV_WEAR_ADD))
   62.55 +			{
   62.56 +				wear_multiple(ids, false);
   62.57 +			}
   62.58 +			else if (item->getType() == LLAssetType::AT_OBJECT && LLAppearanceMgr::instance().canAddWearables(ids) && (!RlvActions::isRlvEnabled() || (gRlvAttachmentLocks.canAttach(item) & RLV_WEAR_ADD) == RLV_WEAR_ADD))
   62.59 +			{
   62.60 +				wear_multiple(ids, false);
   62.61 +			}
   62.62 +		}
   62.63 +	}
   62.64 +}
   62.65 +// </FS:Ansariel>
   62.66 +
   62.67  //virtual
   62.68  void LLOutfitsList::onHighlightBaseOutfit(LLUUID base_id, LLUUID prev_id)
   62.69  {
    63.1 --- a/indra/newview/lloutfitslist.h	Tue May 01 16:45:50 2018 +0200
    63.2 +++ b/indra/newview/lloutfitslist.h	Tue May 08 18:31:13 2018 +0200
    63.3 @@ -334,6 +334,9 @@
    63.4  
    63.5  	static void onOutfitRename(const LLSD& notification, const LLSD& response);
    63.6  
    63.7 +	// <FS:Ansariel> FIRE-22484: Double-click wear in outfits list
    63.8 +	void onDoubleClick(LLWearableItemsList* list);
    63.9 +
   63.10  	//LLInventoryCategoriesObserver* 	mCategoriesObserver;
   63.11  
   63.12  	LLAccordionCtrl*				mAccordion;
    64.1 --- a/indra/newview/llpanelface.cpp	Tue May 01 16:45:50 2018 +0200
    64.2 +++ b/indra/newview/llpanelface.cpp	Tue May 08 18:31:13 2018 +0200
    64.3 @@ -1560,7 +1560,7 @@
    64.4  // static
    64.5  F32 LLPanelFace::valueGlow(LLViewerObject* object, S32 face)
    64.6  {
    64.7 -	return (F32)(object->getTE(face)->getGlow());
    64.8 +	return (F32)(object->getTEref(face).getGlow());
    64.9  }
   64.10  
   64.11  
   64.12 @@ -2448,8 +2448,8 @@
   64.13  	{
   64.14  		viewer_media_t pMediaImpl;
   64.15  				
   64.16 -		const LLTextureEntry* tep = object->getTE(te);
   64.17 -		const LLMediaEntry* mep = tep->hasMedia() ? tep->getMediaData() : NULL;
   64.18 +		const LLTextureEntry &tep = object->getTEref(te);
   64.19 +		const LLMediaEntry* mep = tep.hasMedia() ? tep.getMediaData() : NULL;
   64.20  		if ( mep )
   64.21  		{
   64.22  			pMediaImpl = LLViewerMedia::getMediaImplFromTextureID(mep->getMediaID());
   64.23 @@ -2458,7 +2458,7 @@
   64.24  		if ( pMediaImpl.isNull())
   64.25  		{
   64.26  			// If we didn't find face media for this face, check whether this face is showing parcel media.
   64.27 -			pMediaImpl = LLViewerMedia::getMediaImplFromTextureID(tep->getID());
   64.28 +			pMediaImpl = LLViewerMedia::getMediaImplFromTextureID(tep.getID());
   64.29  		}
   64.30  		
   64.31  		if ( pMediaImpl.notNull())
   64.32 @@ -2640,7 +2640,7 @@
   64.33  	{
   64.34  		LLMaterialPtr get(LLViewerObject* object, S32 te_index)
   64.35  		{
   64.36 -			return object->getTE(te_index)->getMaterialParams();
   64.37 +			return object->getTEref(te_index).getMaterialParams();
   64.38  		}
   64.39  	} func;
   64.40  	identical_material = LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue( &func, material_ptr);
   64.41 @@ -2652,7 +2652,7 @@
   64.42  	{
   64.43  		F32 get(LLViewerObject* object, S32 face)
   64.44  		{
   64.45 -			LLMaterial* mat = object->getTE(face)->getMaterialParams().get();
   64.46 +			LLMaterial* mat = object->getTEref(face).getMaterialParams().get();
   64.47  			U32 s_axis = VX;
   64.48  			U32 t_axis = VY;
   64.49  			F32 repeats_s = 1.0f;
   64.50 @@ -2676,7 +2676,7 @@
   64.51  	{
   64.52  		F32 get(LLViewerObject* object, S32 face)
   64.53  		{
   64.54 -			LLMaterial* mat = object->getTE(face)->getMaterialParams().get();
   64.55 +			LLMaterial* mat = object->getTEref(face).getMaterialParams().get();
   64.56  			U32 s_axis = VX;
   64.57  			U32 t_axis = VY;
   64.58  			F32 repeats_s = 1.0f;
   64.59 @@ -2764,8 +2764,8 @@
   64.60  			U32 s_axis = VX;
   64.61  			U32 t_axis = VY;
   64.62  			LLPrimitive::getTESTAxes(face, &s_axis, &t_axis);
   64.63 -			F32 repeats_s = object->getTE(face)->mScaleS / object->getScale().mV[s_axis];
   64.64 -			F32 repeats_t = object->getTE(face)->mScaleT / object->getScale().mV[t_axis];
   64.65 +			F32 repeats_s = object->getTEref(face).mScaleS / object->getScale().mV[s_axis];
   64.66 +			F32 repeats_t = object->getTEref(face).mScaleT / object->getScale().mV[t_axis];
   64.67  			return llmax(repeats_s, repeats_t);
   64.68  		}
   64.69  
    65.1 --- a/indra/newview/llpanelplaceprofile.cpp	Tue May 01 16:45:50 2018 +0200
    65.2 +++ b/indra/newview/llpanelplaceprofile.cpp	Tue May 08 18:31:13 2018 +0200
    65.3 @@ -602,10 +602,10 @@
    65.4  		S32 primitives = llmin(ll_round(parcel->getMaxPrimCapacity() * parcel->getParcelPrimBonus()),
    65.5  							   (S32)region->getMaxTasks());
    65.6  
    65.7 -		const U8* available = (U8*)getString("available").c_str();
    65.8 -		const U8* allocated = (U8*)getString("allocated").c_str();
    65.9 +		std::string available = getString("available");
   65.10 +		std::string allocated = getString("allocated");
   65.11  
   65.12 -		mPrimitivesText->setText(llformat("%d %s, %d %s", primitives, available, parcel->getPrimCount(), allocated));
   65.13 +		mPrimitivesText->setText(llformat("%d %s, %d %s", primitives, available.c_str(), parcel->getPrimCount(), allocated.c_str() ));
   65.14  
   65.15  		if (parcel->getAllowOtherScripts())
   65.16  		{
    66.1 --- a/indra/newview/llpanelprimmediacontrols.cpp	Tue May 01 16:45:50 2018 +0200
    66.2 +++ b/indra/newview/llpanelprimmediacontrols.cpp	Tue May 08 18:31:13 2018 +0200
    66.3 @@ -318,7 +318,7 @@
    66.4  	{
    66.5  		bool hasPermsControl = true;
    66.6  		bool mini_controls = false;
    66.7 -		LLMediaEntry *media_data = objectp->getTE(mTargetObjectFace)->getMediaData();
    66.8 +		LLMediaEntry *media_data = objectp->getTEref(mTargetObjectFace).getMediaData();
    66.9  		if (media_data && NULL != dynamic_cast<LLVOVolume*>(objectp))
   66.10  		{
   66.11  			// Don't show the media controls if we do not have permissions
   66.12 @@ -810,7 +810,7 @@
   66.13  	LLMediaEntry *media_data(0);
   66.14  
   66.15  	if( objectp )
   66.16 -		media_data = objectp->getTE(mTargetObjectFace)->getMediaData();
   66.17 +		media_data = objectp->getTEref(mTargetObjectFace).getMediaData();
   66.18  
   66.19  	if( !dynamic_cast<LLVOVolume*>(objectp) || !media_data || dynamic_cast<LLVOVolume*>(objectp)->hasMediaPermission(media_data, LLVOVolume::MEDIA_PERM_CONTROL) )
   66.20  		mBackgroundImage->draw( controls_bg_area, UI_VERTEX_COLOR % alpha);
    67.1 --- a/indra/newview/llpanelwearing.cpp	Tue May 01 16:45:50 2018 +0200
    67.2 +++ b/indra/newview/llpanelwearing.cpp	Tue May 08 18:31:13 2018 +0200
    67.3 @@ -47,8 +47,10 @@
    67.4  #include "llsdserialize.h"
    67.5  #include "llclipboard.h"
    67.6  // [RLVa:KB] - Checked: 2012-07-28 (RLVa-1.4.7)
    67.7 +#include "rlvactions.h"
    67.8  #include "rlvcommon.h"
    67.9  #include "rlvhandler.h"
   67.10 +#include "rlvlocks.h"
   67.11  // [/RLVa:KB]
   67.12  #include "lltextbox.h"
   67.13  #include "llresmgr.h"
   67.14 @@ -293,10 +295,12 @@
   67.15  
   67.16  	mCOFItemsList = getChild<LLWearableItemsList>("cof_items_list");
   67.17  	mCOFItemsList->setRightMouseDownCallback(boost::bind(&LLPanelWearing::onWearableItemsListRightClick, this, _1, _2, _3));
   67.18 +	mCOFItemsList->setDoubleClickCallback(boost::bind(&LLPanelWearing::onDoubleClick, this)); // <FS:Ansariel> FIRE-22484: Double-click wear in outfits list
   67.19  
   67.20  	mTempItemsList = getChild<LLScrollListCtrl>("temp_attachments_list");
   67.21  	mTempItemsList->setFgUnselectedColor(LLColor4::white);
   67.22  	mTempItemsList->setRightMouseDownCallback(boost::bind(&LLPanelWearing::onTempAttachmentsListRightClick, this, _1, _2, _3));
   67.23 +	mTempItemsList->setDoubleClickCallback(boost::bind(&LLPanelWearing::onRemoveAttachment, this)); // <FS:Ansariel> FIRE-22484: Double-click wear in outfits list
   67.24  
   67.25  	// <FS:Ansariel> Show avatar complexity in appearance floater
   67.26  	mAvatarComplexityLabel = getChild<LLTextBox>("avatar_complexity_label");
   67.27 @@ -664,4 +668,24 @@
   67.28  	updateAttachmentsList();
   67.29  }
   67.30  // </FS:Ansariel>
   67.31 +
   67.32 +// <FS:Ansariel> FIRE-22484: Double-click wear in outfits list
   67.33 +void LLPanelWearing::onDoubleClick()
   67.34 +{
   67.35 +	LLUUID selected_item_id = mCOFItemsList->getSelectedUUID();
   67.36 +	if (selected_item_id.notNull())
   67.37 +	{
   67.38 +		uuid_vec_t ids;
   67.39 +		ids.push_back(selected_item_id);
   67.40 +		LLViewerInventoryItem* item = gInventory.getItem(selected_item_id);
   67.41 +
   67.42 +		if ((item->getType() == LLAssetType::AT_CLOTHING && (!RlvActions::isRlvEnabled() || gRlvWearableLocks.canRemove(item))) ||
   67.43 +			((item->getType() == LLAssetType::AT_OBJECT) && (!RlvActions::isRlvEnabled() || gRlvAttachmentLocks.canDetach(item))))
   67.44 +		{
   67.45 +			LLAppearanceMgr::instance().removeItemsFromAvatar(ids);
   67.46 +		}
   67.47 +	}
   67.48 +}
   67.49 +// </FS:Ansariel>
   67.50 +
   67.51  // EOF
    68.1 --- a/indra/newview/llpanelwearing.h	Tue May 01 16:45:50 2018 +0200
    68.2 +++ b/indra/newview/llpanelwearing.h	Tue May 08 18:31:13 2018 +0200
    68.3 @@ -94,6 +94,9 @@
    68.4  
    68.5  	void getAttachmentLimitsCoro(std::string url);
    68.6  
    68.7 +	// <FS:Ansariel> FIRE-22484: Double-click wear in outfits list
    68.8 +	void onDoubleClick();
    68.9 +
   68.10  	LLInventoryCategoriesObserver* 	mCategoriesObserver;
   68.11  	LLWearableItemsList* 			mCOFItemsList;
   68.12  	LLScrollListCtrl*				mTempItemsList;
    69.1 --- a/indra/newview/llselectmgr.cpp	Tue May 01 16:45:50 2018 +0200
    69.2 +++ b/indra/newview/llselectmgr.cpp	Tue May 08 18:31:13 2018 +0200
    69.3 @@ -1815,7 +1815,7 @@
    69.4  		{
    69.5  			if (object->permModify())
    69.6  			{
    69.7 -				LLColor4 prev_color = object->getTE(te)->getColor();
    69.8 +				LLColor4 prev_color = object->getTEref(te).getColor();
    69.9  				mColor.mV[VALPHA] = prev_color.mV[VALPHA];
   69.10  				// update viewer side color in anticipation of update from simulator
   69.11  				object->setTEColor(te, mColor);
   69.12 @@ -1842,7 +1842,7 @@
   69.13  		{
   69.14  			if (object->permModify())
   69.15  			{
   69.16 -				LLColor4 prev_color = object->getTE(te)->getColor();
   69.17 +				LLColor4 prev_color = object->getTEref(te).getColor();
   69.18  				prev_color.mV[VALPHA] = mAlpha;
   69.19  				// update viewer side color in anticipation of update from simulator
   69.20  				object->setTEColor(te, prev_color);
   69.21 @@ -1898,12 +1898,12 @@
   69.22  				{
   69.23  					LLColor4 color = nodep->mSavedShinyColors[te];
   69.24  					// update viewer side color in anticipation of update from simulator
   69.25 -					LLMaterialPtr old_mat = object->getTE(te)->getMaterialParams();
   69.26 +					LLMaterialPtr old_mat = object->getTEref(te).getMaterialParams();
   69.27  					if (!old_mat.isNull())
   69.28  					{
   69.29  						LLMaterialPtr new_mat = gFloaterTools->getPanelFace()->createDefaultMaterial(old_mat);
   69.30  						new_mat->setSpecularLightColor(color);
   69.31 -						object->getTE(te)->setMaterialParams(new_mat);
   69.32 +						object->getTEref(te).setMaterialParams(new_mat);
   69.33  						LLMaterialMgr::getInstance()->put(object->getID(), te, *new_mat);
   69.34  					}
   69.35  				}
   69.36 @@ -2275,7 +2275,7 @@
   69.37  	{
   69.38  		F32 get(LLViewerObject* object, S32 face)
   69.39  		{
   69.40 -			return object->getTE(face)->getGlow();
   69.41 +			return object->getTEref(face).getGlow();
   69.42  		}
   69.43  	} func;
   69.44  	identical = mSelectedObjects->getSelectedTEValue( &func, lglow );
   69.45 @@ -2674,6 +2674,10 @@
   69.46  		{
   69.47  			const LLTextureEntry* tep = object->getTE(te_num);
   69.48  
   69.49 +			// ND: Down the code there is a check if getTE did return a valid pointer (actually the pointer is fetched again there, can it change mid loop?)
   69.50 +			if( !tep )
   69.51 +				continue;
   69.52 +
   69.53  			BOOL planar = tep->getTexGen() == LLTextureEntry::TEX_GEN_PLANAR;
   69.54  			if (planar == stretch)
   69.55  			{
   69.56 @@ -6239,8 +6243,8 @@
   69.57  		mSavedColors.clear();
   69.58  		for (S32 i = 0; i < mObject->getNumTEs(); i++)
   69.59  		{
   69.60 -			const LLTextureEntry* tep = mObject->getTE(i);
   69.61 -			mSavedColors.push_back(tep->getColor());
   69.62 +			const LLTextureEntry &tep = mObject->getTEref(i);
   69.63 +			mSavedColors.push_back(tep.getColor());
   69.64  		}
   69.65  	}
   69.66  }
   69.67 @@ -6252,7 +6256,7 @@
   69.68  		mSavedShinyColors.clear();
   69.69  		for (S32 i = 0; i < mObject->getNumTEs(); i++)
   69.70  		{
   69.71 -			const LLMaterialPtr mat = mObject->getTE(i)->getMaterialParams();
   69.72 +			const LLMaterialPtr mat = mObject->getTEref(i).getMaterialParams();
   69.73  			if (!mat.isNull())
   69.74  			{
   69.75  				mSavedShinyColors.push_back(mat->getSpecularLightColor());
    70.1 --- a/indra/newview/lltexturecache.cpp	Tue May 01 16:45:50 2018 +0200
    70.2 +++ b/indra/newview/lltexturecache.cpp	Tue May 08 18:31:13 2018 +0200
    70.3 @@ -825,10 +825,6 @@
    70.4  
    70.5  LLTextureCache::LLTextureCache(bool threaded)
    70.6  	: LLWorkerThread("TextureCache", threaded),
    70.7 -	  mWorkersMutex(NULL),
    70.8 -	  mHeaderMutex(NULL),
    70.9 -	  mListMutex(NULL),
   70.10 -	  mFastCacheMutex(NULL),
   70.11  	  mHeaderAPRFile(NULL),
   70.12  	  mReadOnly(TRUE), //do not allow to change the texture cache until setReadOnly() is called.
   70.13  	  mTexturesSizeTotal(0),
    71.1 --- a/indra/newview/lltexturecache.h	Tue May 01 16:45:50 2018 +0200
    71.2 +++ b/indra/newview/lltexturecache.h	Tue May 08 18:31:13 2018 +0200
    71.3 @@ -223,7 +223,7 @@
    71.4  	typedef std::map<LLUUID,S32> size_map_t;
    71.5  	size_map_t mTexturesSizeMap;
    71.6  	S64 mTexturesSizeTotal;
    71.7 -	LLAtomic32<BOOL> mDoPurge;
    71.8 +	LLAtomicBool mDoPurge;
    71.9  
   71.10  	typedef std::map<S32, Entry> idx_entry_map_t;
   71.11  	idx_entry_map_t mUpdatedEntryMap;
    72.1 --- a/indra/newview/lltexturefetch.cpp	Tue May 01 16:45:50 2018 +0200
    72.2 +++ b/indra/newview/lltexturefetch.cpp	Tue May 08 18:31:13 2018 +0200
    72.3 @@ -928,7 +928,6 @@
    72.4  	  mCanUseHTTP(true),
    72.5  	  mRetryAttempt(0),
    72.6  	  mActiveCount(0),
    72.7 -	  mWorkMutex(NULL),
    72.8  	  mFirstPacket(0),
    72.9  	  mLastPacket(-1),
   72.10  	  mTotalPackets(0),
   72.11 @@ -2564,8 +2563,6 @@
   72.12  	  mDebugPause(FALSE),
   72.13  	  mPacketCount(0),
   72.14  	  mBadPacketCount(0),
   72.15 -	  mQueueMutex(getAPRPool()),
   72.16 -	  mNetworkQueueMutex(getAPRPool()),
   72.17  	  mTextureCache(cache),
   72.18  	  mImageDecodeThread(imagedecodethread),
   72.19  	  mTextureBandwidth(0),
    73.1 --- a/indra/newview/lltoolpie.cpp	Tue May 01 16:45:50 2018 +0200
    73.2 +++ b/indra/newview/lltoolpie.cpp	Tue May 08 18:31:13 2018 +0200
    73.3 @@ -1992,7 +1992,7 @@
    73.4  	if( face < 0 || face >= objectp->getNumTEs() ) return;
    73.5  		
    73.6  	// is media playing on this face?
    73.7 -	if (LLViewerMedia::getMediaImplFromTextureID(objectp->getTE(face)->getID()) != NULL)
    73.8 +	if (LLViewerMedia::getMediaImplFromTextureID(objectp->getTEref(face).getID()) != NULL)
    73.9  	{
   73.10  		handle_click_action_play();
   73.11  		return;
    74.1 --- a/indra/newview/llviewermediafocus.cpp	Tue May 01 16:45:50 2018 +0200
    74.2 +++ b/indra/newview/llviewermediafocus.cpp	Tue May 08 18:31:13 2018 +0200
    74.3 @@ -95,7 +95,7 @@
    74.4  		media_impl->setDisabled(false);
    74.5  
    74.6  		LLTextureEntry* tep = objectp->getTE(face);
    74.7 -		if(tep->hasMedia())
    74.8 +		if(tep && tep->hasMedia())
    74.9  		{
   74.10  			LLMediaEntry* mep = tep->getMediaData();
   74.11  			face_auto_zoom = mep->getAutoZoom();
    75.1 --- a/indra/newview/llviewermenu.cpp	Tue May 01 16:45:50 2018 +0200
    75.2 +++ b/indra/newview/llviewermenu.cpp	Tue May 08 18:31:13 2018 +0200
    75.3 @@ -8983,7 +8983,7 @@
    75.4  		{
    75.5  			if (!node->isTESelected(i)) continue;
    75.6  	
    75.7 -			const LLMaterialID& material_id = node->getObject()->getTE(i)->getMaterialID();
    75.8 +			const LLMaterialID& material_id = node->getObject()->getTEref(i).getMaterialID();
    75.9  			faces_per_material[material_id].push_back(i);
   75.10  		}
   75.11  		// Per-material, dump which faces are using it.
    76.1 --- a/indra/newview/llviewermenufile.cpp	Tue May 01 16:45:50 2018 +0200
    76.2 +++ b/indra/newview/llviewermenufile.cpp	Tue May 08 18:31:13 2018 +0200
    76.3 @@ -180,7 +180,7 @@
    76.4  //static
    76.5  void LLFilePickerThread::initClass()
    76.6  {
    76.7 -	sMutex = new LLMutex(NULL);
    76.8 +	sMutex = new LLMutex();
    76.9  }
   76.10  
   76.11  //static
    77.1 --- a/indra/newview/llviewerobject.cpp	Tue May 01 16:45:50 2018 +0200
    77.2 +++ b/indra/newview/llviewerobject.cpp	Tue May 08 18:31:13 2018 +0200
    77.3 @@ -4502,15 +4502,15 @@
    77.4  {
    77.5  	LLPrimitive::setTE(te, texture_entry);
    77.6  
    77.7 -		const LLUUID& image_id = getTE(te)->getID();
    77.8 -		mTEImages[te] = LLViewerTextureManager::getFetchedTexture(image_id, FTT_DEFAULT, TRUE, LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE);
    77.9 -
   77.10 -	if (getTE(te)->getMaterialParams().notNull())
   77.11 -	{
   77.12 -		const LLUUID& norm_id = getTE(te)->getMaterialParams()->getNormalID();
   77.13 +	const LLUUID& image_id = getTEref(te).getID();
   77.14 +	mTEImages[te] = LLViewerTextureManager::getFetchedTexture(image_id, FTT_DEFAULT, TRUE, LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE);
   77.15 +	
   77.16 +	if (getTEref(te).getMaterialParams().notNull())
   77.17 +	{
   77.18 +		const LLUUID& norm_id = getTEref(te).getMaterialParams()->getNormalID();
   77.19  		mTENormalMaps[te] = LLViewerTextureManager::getFetchedTexture(norm_id, FTT_DEFAULT, TRUE, LLGLTexture::BOOST_ALM, LLViewerTexture::LOD_TEXTURE);
   77.20  		
   77.21 -		const LLUUID& spec_id = getTE(te)->getMaterialParams()->getSpecularID();
   77.22 +		const LLUUID& spec_id = getTEref(te).getMaterialParams()->getSpecularID();
   77.23  		mTESpecularMaps[te] = LLViewerTextureManager::getFetchedTexture(spec_id, FTT_DEFAULT, TRUE, LLGLTexture::BOOST_ALM, LLViewerTexture::LOD_TEXTURE);
   77.24  	}
   77.25  }
   77.26 @@ -4534,7 +4534,7 @@
   77.27  {
   77.28  	const LLUUID& uuid = image->getID();
   77.29  	S32 retval = 0;
   77.30 -	if (uuid != getTE(te)->getID() ||
   77.31 +	if (uuid != getTEref(te).getID() ||
   77.32  		uuid == LLUUID::null)
   77.33  	{
   77.34  		retval = LLPrimitive::setTETexture(te, uuid);
   77.35 @@ -4552,7 +4552,7 @@
   77.36  {
   77.37  	S32 retval = TEM_CHANGE_TEXTURE;
   77.38  	const LLUUID& uuid = image ? image->getID() : LLUUID::null;
   77.39 -	if (uuid != getTE(te)->getID() ||
   77.40 +	if( (getTE( te ) && uuid != getTE( te )->getID()) ||
   77.41  		uuid == LLUUID::null)
   77.42  	{
   77.43  		LLTextureEntry* tep = getTE(te);
   77.44 @@ -4575,7 +4575,7 @@
   77.45  {
   77.46  	S32 retval = TEM_CHANGE_TEXTURE;
   77.47  	const LLUUID& uuid = image ? image->getID() : LLUUID::null;
   77.48 -	if (uuid != getTE(te)->getID() ||
   77.49 +	if ( (getTE(te) && uuid != getTE(te)->getID()) ||
   77.50  		uuid == LLUUID::null)
   77.51  	{
   77.52  		LLTextureEntry* tep = getTE(te);
    78.1 --- a/indra/newview/llviewerwindow.cpp	Tue May 01 16:45:50 2018 +0200
    78.2 +++ b/indra/newview/llviewerwindow.cpp	Tue May 08 18:31:13 2018 +0200
    78.3 @@ -426,7 +426,6 @@
    78.4  		}
    78.5  		}
    78.6  		
    78.7 -#if LL_WINDOWS
    78.8  		//if (gSavedSettings.getBOOL("DebugShowMemory"))
    78.9  		static LLCachedControl<bool> debugShowMemory(gSavedSettings, "DebugShowMemory");
   78.10  		if (debugShowMemory)
   78.11 @@ -435,7 +434,6 @@
   78.12  					STRINGIZE("Memory: " << (LLMemory::getCurrentRSS() / 1024) << " (KB)"));
   78.13  			ypos += y_inc;
   78.14  		}
   78.15 -#endif
   78.16  
   78.17  		if (gDisplayCameraPos)
   78.18  		{
   78.19 @@ -1238,7 +1236,7 @@
   78.20  						LLTextureEntry *te = obj->getTE(object_face);
   78.21  
   78.22  						// can modify URL if we can modify the object or we have navigate permissions
   78.23 -						bool allow_modify_url = obj->permModify() || obj->hasMediaPermission( te->getMediaData(), LLVOVolume::MEDIA_PERM_INTERACT );
   78.24 +						bool allow_modify_url = obj->permModify() || (te && obj->hasMediaPermission( te->getMediaData(), LLVOVolume::MEDIA_PERM_INTERACT ));
   78.25  
   78.26  						if (te && allow_modify_url )
   78.27  						{
   78.28 @@ -7048,8 +7046,8 @@
   78.29  {
   78.30  	if (mObjectFace > -1)
   78.31  	{
   78.32 -		const LLTextureEntry* tep = getObject()->getTE(mObjectFace);
   78.33 -		LLPointer<LLViewerTexture> imagep = LLViewerTextureManager::getFetchedTexture(tep->getID());
   78.34 +		const LLTextureEntry &tep = getObject()->getTEref(mObjectFace);
   78.35 +		LLPointer<LLViewerTexture> imagep = LLViewerTextureManager::getFetchedTexture(tep.getID());
   78.36  		if(mUVCoords.mV[VX] >= 0.f && mUVCoords.mV[VY] >= 0.f && imagep.notNull())
   78.37  		{
   78.38  			mXYCoords.mX = ll_round(mUVCoords.mV[VX] * (F32)imagep->getWidth());
    79.1 --- a/indra/newview/llvoavatar.cpp	Tue May 01 16:45:50 2018 +0200
    79.2 +++ b/indra/newview/llvoavatar.cpp	Tue May 08 18:31:13 2018 +0200
    79.3 @@ -1,4 +1,4 @@
    79.4 -/** 
    79.5 +/** 
    79.6   * @File llvoavatar.cpp
    79.7   * @brief Implementation of LLVOAvatar class which is a derivation of LLViewerObject
    79.8   *
    79.9 @@ -8940,7 +8940,7 @@
   79.10  			// <FS:Ansariel> [Legacy Bake]
   79.11  			//LL_DEBUGS("Avatar") << avString() << " baked_index " << (S32) baked_index << " using texture id "
   79.12  			LL_DEBUGS("Avatar") << avString() << "sb " << (S32) isUsingServerBakes() << " baked_index " << (S32) baked_index << " using texture id "
   79.13 -								<< getTE(mBakedTextureDatas[baked_index].mTextureIndex)->getID() << LL_ENDL;
   79.14 +								<< getTEref(mBakedTextureDatas[baked_index].mTextureIndex).getID() << LL_ENDL;
   79.15  		}
   79.16  	}
   79.17  
    80.1 --- a/indra/newview/llvoavatarself.cpp	Tue May 01 16:45:50 2018 +0200
    80.2 +++ b/indra/newview/llvoavatarself.cpp	Tue May 08 18:31:13 2018 +0200
    80.3 @@ -3267,9 +3267,9 @@
    80.4  		const LLAvatarAppearanceDictionary::TextureEntry *texture_dict = iter->second;
    80.5  		if (!texture_dict->mIsBakedTexture)
    80.6  		{
    80.7 -			LLTextureEntry* entry = getTE((U8) index);
    80.8 -			texture_id[index] = entry->getID();
    80.9 -			entry->setID(IMG_DEFAULT_AVATAR);
   80.10 +			LLTextureEntry &entry = getTEref((U8) index);
   80.11 +			texture_id[index] = entry.getID();
   80.12 +			entry.setID(IMG_DEFAULT_AVATAR);
   80.13  		}
   80.14  	}
   80.15  	
   80.16 @@ -3310,8 +3310,8 @@
   80.17  		const LLAvatarAppearanceDictionary::TextureEntry *texture_dict = iter->second;
   80.18  		if (!texture_dict->mIsBakedTexture)
   80.19  		{
   80.20 -			LLTextureEntry* entry = getTE((U8) index);
   80.21 -			entry->setID(texture_id[index]);
   80.22 +			LLTextureEntry &entry = getTEref((U8) index);
   80.23 +			entry.setID(texture_id[index]);
   80.24  		}
   80.25  	}
   80.26  
    81.1 --- a/indra/newview/llvovolume.cpp	Tue May 01 16:45:50 2018 +0200
    81.2 +++ b/indra/newview/llvovolume.cpp	Tue May 08 18:31:13 2018 +0200
    81.3 @@ -82,6 +82,7 @@
    81.4  #include "rlvactions.h"
    81.5  #include "rlvlocks.h"
    81.6  // [/RLVa:KB]
    81.7 +#include "llviewernetwork.h"
    81.8  
    81.9  const F32 FORCE_SIMPLE_RENDER_AREA = 512.f;
   81.10  const F32 FORCE_CULL_AREA = 8.f;
   81.11 @@ -322,6 +323,11 @@
   81.12  										  U32 block_num, EObjectUpdateType update_type,
   81.13  										  LLDataPacker *dp)
   81.14  {
   81.15 +	// <FS:Ansariel> Improved bad object handling
   81.16 +	static LLCachedControl<bool> fsEnforceStrictObjectCheck(gSavedSettings, "FSEnforceStrictObjectCheck");
   81.17 +	bool enfore_strict_object_check = LLGridManager::instance().isInSecondLife() && fsEnforceStrictObjectCheck;
   81.18 +	// </FS:Ansariel>
   81.19 +
   81.20  	LLColor4U color;
   81.21  	const S32 teDirtyBits = (TEM_CHANGE_TEXTURE|TEM_CHANGE_COLOR|TEM_CHANGE_MEDIA);
   81.22  
   81.23 @@ -388,7 +394,7 @@
   81.24  				if (getRegion())
   81.25  				{
   81.26  					region_name = getRegion()->getName();
   81.27 -					if (gSavedSettings.getBOOL("FSEnforceStrictObjectCheck"))
   81.28 +					if (enfore_strict_object_check)
   81.29  					{
   81.30  						LL_WARNS() << "An invalid object (" << getID() << ") has been removed (FSEnforceStrictObjectCheck)" << LL_ENDL;
   81.31  						getRegion()->addCacheMissFull(getLocalID()); // force cache skip the object
   81.32 @@ -397,7 +403,7 @@
   81.33  				LL_WARNS() << "Bogus volume parameters in object " << getID() << " @ " << getPositionRegion()
   81.34  					<< " in " << region_name << LL_ENDL;
   81.35  				
   81.36 -				if (gSavedSettings.getBOOL("FSEnforceStrictObjectCheck"))
   81.37 +				if (enfore_strict_object_check)
   81.38  				{
   81.39  					gObjectList.killObject(this);
   81.40  					return (INVALID_UPDATE);
   81.41 @@ -429,7 +435,7 @@
   81.42  			if (getRegion())
   81.43  			{
   81.44  				region_name = getRegion()->getName();
   81.45 -				if (gSavedSettings.getBOOL("FSEnforceStrictObjectCheck"))
   81.46 +				if (enfore_strict_object_check)
   81.47  				{
   81.48  					LL_WARNS() << "An invalid object (" << getID() << ") has been removed (FSEnforceStrictObjectCheck)" << LL_ENDL;
   81.49  					getRegion()->addCacheMissFull(getLocalID()); // force cache skip
   81.50 @@ -438,7 +444,7 @@
   81.51  
   81.52  			LL_WARNS() << "Bogus TE data in object " << getID() << " @ " << getPositionRegion()
   81.53  				<< " in " << region_name << LL_ENDL;
   81.54 -			if (gSavedSettings.getBOOL("FSEnforceStrictObjectCheck"))
   81.55 +			if (enfore_strict_object_check)
   81.56  			{
   81.57  				gObjectList.killObject(this);
   81.58  				return (INVALID_UPDATE);
   81.59 @@ -469,7 +475,7 @@
   81.60  				if (getRegion())
   81.61  				{
   81.62  					region_name = getRegion()->getName();
   81.63 -					if (gSavedSettings.getBOOL("FSEnforceStrictObjectCheck"))
   81.64 +					if (enfore_strict_object_check)
   81.65  					{
   81.66  						LL_WARNS() << "An invalid object (" << getID() << ") has been removed (FSEnforceStrictObjectCheck)" << LL_ENDL;
   81.67  						getRegion()->addCacheMissFull(getLocalID()); // force cache skip the object
   81.68 @@ -484,7 +490,7 @@
   81.69  				// <FS:Beq> July 2017 Change backed out due to side effects. FIRE-16995 still an exposure. 
   81.70  				// return(INVALID_UPDATE);
   81.71  				// NOTE: An option here would be to correctly return the media status using "retval |= INVALID_UPDATE"
   81.72 -				if (gSavedSettings.getBOOL("FSEnforceStrictObjectCheck"))
   81.73 +				if (enfore_strict_object_check)
   81.74  				{
   81.75  					gObjectList.killObject(this);
   81.76  					return (INVALID_UPDATE);
   81.77 @@ -516,7 +522,7 @@
   81.78  				if (getRegion())
   81.79  				{
   81.80  					region_name = getRegion()->getName();
   81.81 -					if (gSavedSettings.getBOOL("FSEnforceStrictObjectCheck"))
   81.82 +					if (enfore_strict_object_check)
   81.83  					{
   81.84  						LL_WARNS() << "An invalid object (" << getID() << ") has been removed (FSEnforceStrictObjectCheck)" << LL_ENDL;
   81.85  						getRegion()->addCacheMissFull(getLocalID()); // force cache skip
   81.86 @@ -525,7 +531,7 @@
   81.87  						
   81.88  				LL_WARNS() << "Bogus TE data in object " << getID() << " @ " << getPositionRegion()
   81.89  					<< " in " << region_name << LL_ENDL;
   81.90 -				if (gSavedSettings.getBOOL("FSEnforceStrictObjectCheck"))
   81.91 +				if (enfore_strict_object_check)
   81.92  				{
   81.93  					gObjectList.killObject(this);
   81.94  					return (INVALID_UPDATE);
   81.95 @@ -1041,9 +1047,9 @@
   81.96  
   81.97  LLFace* LLVOVolume::addFace(S32 f)
   81.98  {
   81.99 -	const LLTextureEntry* te = getTE(f);
  81.100 +	const LLTextureEntry *te = getTE(f);
  81.101  	LLViewerTexture* imagep = getTEImage(f);
  81.102 -	if (te->getMaterialParams().notNull())
  81.103 +	if ( te && te->getMaterialParams().notNull())
  81.104  	{
  81.105  		LLViewerTexture* normalp = getTENormalMap(f);
  81.106  		LLViewerTexture* specularp = getTESpecularMap(f);
  81.107 @@ -1534,7 +1540,7 @@
  81.108  		LLFace *face = mDrawable->getFace(i);
  81.109  		if (face)
  81.110  		{
  81.111 -			BOOL fullbright = getTE(i)->getFullbright();
  81.112 +			BOOL fullbright = getTEref(i).getFullbright();
  81.113  			face->clearState(LLFace::FULLBRIGHT | LLFace::HUD_RENDER | LLFace::LIGHT);
  81.114  
  81.115  			if (fullbright || (mMaterial == LL_MCODE_LIGHT))
  81.116 @@ -2018,10 +2024,10 @@
  81.117  		if(mMediaImplList.size() >= old_num_tes && mMediaImplList[old_num_tes -1].notNull())//duplicate the last media textures if exists.
  81.118  		{
  81.119  			mMediaImplList.resize(num_tes) ;
  81.120 -			const LLTextureEntry* te = getTE(old_num_tes - 1) ;
  81.121 +			const LLTextureEntry &te = getTEref(old_num_tes - 1) ;
  81.122  			for(U8 i = old_num_tes; i < num_tes ; i++)
  81.123  			{
  81.124 -				setTE(i, *te) ;
  81.125 +				setTE(i, te) ;
  81.126  				mMediaImplList[i] = mMediaImplList[old_num_tes -1] ;
  81.127  			}
  81.128  			mMediaImplList[old_num_tes -1]->setUpdated(TRUE) ;
  81.129 @@ -2535,7 +2541,7 @@
  81.130  	for (U8 i = 0; i < numTEs; i++)
  81.131  	{
  81.132  		const LLTextureEntry* te = getTE(i);
  81.133 -		if(te->hasMedia())
  81.134 +		if( te && te->hasMedia())
  81.135  		{
  81.136  			result = true;
  81.137  			break;
  81.138 @@ -2588,7 +2594,7 @@
  81.139  	for (U8 i = 0; i < numTEs; i++)
  81.140  	{
  81.141  		const LLTextureEntry* te = getTE(i);
  81.142 -		if( ! te->hasMedia())
  81.143 +		if( te && ! te->hasMedia())
  81.144  		{
  81.145  			// Delete the media IMPL!
  81.146  			removeMediaImpl(i) ;
    82.1 --- a/indra/newview/llwatchdog.cpp	Tue May 01 16:45:50 2018 +0200
    82.2 +++ b/indra/newview/llwatchdog.cpp	Tue May 08 18:31:13 2018 +0200
    82.3 @@ -192,7 +192,7 @@
    82.4  	mKillerCallback = func;
    82.5  	if(!mSuspectsAccessMutex && !mTimer)
    82.6  	{
    82.7 -		mSuspectsAccessMutex = new LLMutex(NULL);
    82.8 +		mSuspectsAccessMutex = new LLMutex();
    82.9  		mTimer = new LLWatchdogTimerThread();
   82.10  		mTimer->setSleepTime(WATCHDOG_SLEEP_TIME_USEC / 1000);
   82.11  		mLastClockCount = LLTimer::getTotalTime();
    83.1 --- a/indra/newview/pipeline.cpp	Tue May 01 16:45:50 2018 +0200
    83.2 +++ b/indra/newview/pipeline.cpp	Tue May 08 18:31:13 2018 +0200
    83.3 @@ -3840,7 +3840,7 @@
    83.4  	U8 tecount=vobj->getNumTEs();
    83.5  	for(int x=0;x<tecount;x++)
    83.6  	{
    83.7 -		if(vobj->getTE(x)->hasMedia())
    83.8 +		if(vobj->getTEref(x).hasMedia())
    83.9  		{
   83.10  			beacon=true;
   83.11  			break;
    84.1 --- a/indra/newview/skins/default/xui/de/menu_fs_radar.xml	Tue May 01 16:45:50 2018 +0200
    84.2 +++ b/indra/newview/skins/default/xui/de/menu_fs_radar.xml	Tue May 08 18:31:13 2018 +0200
    84.3 @@ -34,4 +34,9 @@
    84.4  	<menu_item_call label="Estate: Verbannen" name="estate_ban"/>
    84.5  	<menu_item_call label="Nicht anzeigen" name="derender"/>
    84.6  	<menu_item_call label="Nicht anzeigen &amp; Blacklist" name="derender_permanent"/>
    84.7 +	<menu label="Anzeigeeinstellungen" name="render_settings">
    84.8 +		<menu_item_check label="Normal darstellen" name="av_render_normal"/>
    84.9 +		<menu_item_check label="Nicht darstellen" name="av_render_never"/>
   84.10 +		<menu_item_check label="Komplett darstellen" name="av_render_always"/>
   84.11 +	</menu>
   84.12  </context_menu>
    85.1 --- a/indra/newview/skins/default/xui/de/menu_fs_radar_multiselect.xml	Tue May 01 16:45:50 2018 +0200
    85.2 +++ b/indra/newview/skins/default/xui/de/menu_fs_radar_multiselect.xml	Tue May 08 18:31:13 2018 +0200
    85.3 @@ -24,4 +24,9 @@
    85.4  	<menu_item_call label="Estate: Verbannen" name="estate_ban"/>
    85.5  	<menu_item_call label="Nicht anzeigen" name="derender"/>
    85.6  	<menu_item_call label="Nicht anzeigen &amp; Blacklist" name="derender_permanent"/>
    85.7 +	<menu label="Anzeigeeinstellungen" name="render_settings">
    85.8 +		<menu_item_call label="Normal darstellen" name="av_render_normal"/>
    85.9 +		<menu_item_call label="Nicht darstellen" name="av_render_never"/>
   85.10 +		<menu_item_call label="Komplett darstellen" name="av_render_always"/>
   85.11 +	</menu>
   85.12  </context_menu>
    86.1 --- a/indra/newview/skins/default/xui/de/panel_preferences_firestorm.xml	Tue May 01 16:45:50 2018 +0200
    86.2 +++ b/indra/newview/skins/default/xui/de/panel_preferences_firestorm.xml	Tue May 08 18:31:13 2018 +0200
    86.3 @@ -273,6 +273,7 @@
    86.4  			Um einen Zielordner zu ändern, im Inventar auf den gewünschten Ordner rechts-klicken und
    86.5  „Als Standard nutzen für“ auswählen.
    86.6  		</text>
    86.7 +		<button name="reset_default_folders" label="Standard-Ordner zurücksetzen"/>
    86.8  	</panel>
    86.9  </tab_container>
   86.10  </panel>
    87.1 --- a/indra/newview/skins/default/xui/en/menu_fs_radar.xml	Tue May 01 16:45:50 2018 +0200
    87.2 +++ b/indra/newview/skins/default/xui/en/menu_fs_radar.xml	Tue May 08 18:31:13 2018 +0200
    87.3 @@ -258,4 +258,36 @@
    87.4  		<menu_item_call.on_click
    87.5  			function="Avatar.DerenderPermanent"/>
    87.6  	</menu_item_call>
    87.7 +	<menu label="Render Settings" name="render_settings">
    87.8 +		<menu_item_check
    87.9 +			label="Render Normally"
   87.10 +			name="av_render_normal">
   87.11 +			<menu_item_check.on_click
   87.12 +				function="Nearby.People.SetRenderMode"
   87.13 +				parameter="0" />
   87.14 +			<menu_item_check.on_check
   87.15 +				function="Nearby.People.CheckRenderMode"
   87.16 +				parameter="0" />
   87.17 +		</menu_item_check>
   87.18 +		<menu_item_check
   87.19 +			label="Do Not Render"
   87.20 +			name="av_render_never">
   87.21 +			<menu_item_check.on_click
   87.22 +				function="Nearby.People.SetRenderMode"
   87.23 +				parameter="1" />
   87.24 +			<menu_item_check.on_check
   87.25 +				function="Nearby.People.CheckRenderMode"
   87.26 +				parameter="1" />
   87.27 +		</menu_item_check>
   87.28 +		<menu_item_check
   87.29 +			label="Render Fully"
   87.30 +			name="av_render_always">
   87.31 +			<menu_item_check.on_click
   87.32 +				function="Nearby.People.SetRenderMode"
   87.33 +				parameter="2" />
   87.34 +			<menu_item_check.on_check
   87.35 +				function="Nearby.People.CheckRenderMode"
   87.36 +				parameter="2" />
   87.37 +		</menu_item_check>
   87.38 +	</menu>
   87.39  </context_menu>
    88.1 --- a/indra/newview/skins/default/xui/en/menu_fs_radar_multiselect.xml	Tue May 01 16:45:50 2018 +0200
    88.2 +++ b/indra/newview/skins/default/xui/en/menu_fs_radar_multiselect.xml	Tue May 08 18:31:13 2018 +0200
    88.3 @@ -179,4 +179,27 @@
    88.4  		<menu_item_call.on_click
    88.5  			function="Avatar.DerenderPermanent"/>
    88.6  	</menu_item_call>
    88.7 +	<menu label="Render Settings" name="render_settings">
    88.8 +		<menu_item_call
    88.9 +			label="Render Normally"
   88.10 +			name="av_render_normal">
   88.11 +			<menu_item_call.on_click
   88.12 +				function="Nearby.People.SetRenderMode"
   88.13 +				parameter="0" />
   88.14 +		</menu_item_call>
   88.15 +		<menu_item_call
   88.16 +			label="Do Not Render"
   88.17 +			name="av_render_never">
   88.18 +			<menu_item_call.on_click
   88.19 +				function="Nearby.People.SetRenderMode"
   88.20 +				parameter="1" />
   88.21 +		</menu_item_call>
   88.22 +		<menu_item_call
   88.23 +			label="Render Fully"
   88.24 +			name="av_render_always">
   88.25 +			<menu_item_call.on_click
   88.26 +				function="Nearby.People.SetRenderMode"
   88.27 +				parameter="2" />
   88.28 +		</menu_item_call>
   88.29 +	</menu>
   88.30  </context_menu>
    89.1 --- a/indra/newview/skins/default/xui/en/panel_preferences_firestorm.xml	Tue May 01 16:45:50 2018 +0200
    89.2 +++ b/indra/newview/skins/default/xui/en/panel_preferences_firestorm.xml	Tue May 08 18:31:13 2018 +0200
    89.3 @@ -1816,6 +1816,13 @@
    89.4          To change a destination folder, right click on it in inventory and choose
    89.5       "Use as default for"
    89.6        </text>
    89.7 +      <button
    89.8 +       name="reset_default_folders"
    89.9 +       label="Reset default folders"
   89.10 +       left="10"
   89.11 +       top_pad="10"
   89.12 +       width="200"
   89.13 +       follows="left|top" />
   89.14      </panel>
   89.15  </tab_container>
   89.16  </panel>
    90.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    90.2 +++ b/indra/newview/skins/default/xui/pl/floater_fs_ban_duration.xml	Tue May 08 18:31:13 2018 +0200
    90.3 @@ -0,0 +1,11 @@
    90.4 +<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
    90.5 +<floater name="Ban duration" title="Czas trwania bana" width="220">
    90.6 +	<text name="duration_textbox" width="110">
    90.7 +		Czas trwania bana:
    90.8 +	</text>
    90.9 +	<spinner name="ban_time" tool_tip="Ile czasu ma trwać ban, 0 banuje na zawsze"/>
   90.10 +	<text name="hours_textbox">
   90.11 +		godzin.
   90.12 +	</text>
   90.13 +	<button label="Anuluj" name="BanCancelButton" />
   90.14 +</floater>
    91.1 --- a/indra/newview/skins/default/xui/pl/menu_fs_radar.xml	Tue May 01 16:45:50 2018 +0200
    91.2 +++ b/indra/newview/skins/default/xui/pl/menu_fs_radar.xml	Tue May 08 18:31:13 2018 +0200
    91.3 @@ -34,4 +34,9 @@
    91.4  	<menu_item_call label="Majątek: Zbanuj" name="estate_ban"/>
    91.5  	<menu_item_call label="Derenderuj" name="derender"/>
    91.6  	<menu_item_call label="Derenderuj + czarna lista" name="derender_permanent"/>
    91.7 +	<menu label="Ustawienia renderu" name="render_settings">
    91.8 +		<menu_item_check label="Renderuj normalnie" name="av_render_normal" />
    91.9 +		<menu_item_check label="Nigdy nie renderuj" name="av_render_never" />
   91.10 +		<menu_item_check label="Zawsze renderuj w pełni" name="av_render_always" />
   91.11 +	</menu>
   91.12  </context_menu>
    92.1 --- a/indra/newview/skins/default/xui/pl/menu_fs_radar_multiselect.xml	Tue May 01 16:45:50 2018 +0200
    92.2 +++ b/indra/newview/skins/default/xui/pl/menu_fs_radar_multiselect.xml	Tue May 08 18:31:13 2018 +0200
    92.3 @@ -24,4 +24,9 @@
    92.4  	<menu_item_call label="Majątek: Zbanuj" name="estate_ban"/>
    92.5  	<menu_item_call label="Derenderuj" name="derender"/>
    92.6  	<menu_item_call label="Derenderuj + czarna lista" name="derender_permanent"/>
    92.7 +	<menu label="Ustawienia renderu" name="render_settings">
    92.8 +		<menu_item_call label="Renderuj normalnie" name="av_render_normal" />
    92.9 +		<menu_item_call label="Nigdy nie renderuj" name="av_render_never" />
   92.10 +		<menu_item_call label="Zawsze renderuj w pełni" name="av_render_always" />
   92.11 +	</menu>
   92.12  </context_menu>
    93.1 --- a/indra/newview/skins/default/xui/pl/panel_preferences_firestorm.xml	Tue May 01 16:45:50 2018 +0200
    93.2 +++ b/indra/newview/skins/default/xui/pl/panel_preferences_firestorm.xml	Tue May 08 18:31:13 2018 +0200
    93.3 @@ -246,6 +246,7 @@
    93.4              Aby zmienić folder docelowy kliknij na nim prawym przyciskiem myszy w Szafie
    93.5  i użyj opcji "ustaw jako domyślne dla"
    93.6          </text>
    93.7 +        <button name="reset_default_folders" label="Reset folderów domyślnych" />
    93.8      </panel>
    93.9  </tab_container>
   93.10  </panel>
    94.1 --- a/indra/newview/viewer_manifest.py	Tue May 01 16:45:50 2018 +0200
    94.2 +++ b/indra/newview/viewer_manifest.py	Tue May 08 18:31:13 2018 +0200
    94.3 @@ -624,6 +624,7 @@
    94.4  
    94.5              # For textures
    94.6              self.path("openjpeg.dll")
    94.7 +            self.path("openjp2.dll") # <FS:ND/> OpenJPEG2 if used
    94.8  
    94.9              # These need to be installed as a SxS assembly, currently a 'private' assembly.
   94.10              # See http://msdn.microsoft.com/en-us/library/ms235291(VS.80).aspx
   94.11 @@ -2148,8 +2149,8 @@
   94.12                  # --numeric-owner hides the username of the builder for
   94.13                  # security etc.
   94.14                  self.run_command(['tar', '-C', self.get_build_prefix(),
   94.15 -                                  '--numeric-owner', self.fs_linux_tar_excludes(), '-cjf',
   94.16 -                                 tempname + '.tar.bz2', installer_name])
   94.17 +                                  '--numeric-owner', self.fs_linux_tar_excludes(), '-caf',
   94.18 +                                 tempname + '.tar.xz', installer_name])
   94.19              else:
   94.20                  print "Skipping %s.tar.xz for non-Release build (%s)" % \
   94.21                        (installer_name, self.args['buildtype'])

mercurial