summaryrefslogtreecommitdiff
path: root/indra
diff options
context:
space:
mode:
Diffstat (limited to 'indra')
-rw-r--r--indra/llcommon/llthread.h68
-rw-r--r--indra/llplugin/slplugin/CMakeLists.txt3
-rw-r--r--indra/llui/llmodaldialog.h2
3 files changed, 71 insertions, 2 deletions
diff --git a/indra/llcommon/llthread.h b/indra/llcommon/llthread.h
index 11594f276e..a6eb14db9d 100644
--- a/indra/llcommon/llthread.h
+++ b/indra/llcommon/llthread.h
@@ -225,6 +225,71 @@ void LLThread::unlockData()
// see llmemory.h for LLPointer<> definition
+#if (1) // Old code - see comment below
+class LL_COMMON_API LLThreadSafeRefCount
+{
+public:
+ static void initThreadSafeRefCount(); // creates sMutex
+ static void cleanupThreadSafeRefCount(); // destroys sMutex
+
+private:
+ static LLMutex* sMutex;
+
+protected:
+ virtual ~LLThreadSafeRefCount(); // use unref()
+
+public:
+ LLThreadSafeRefCount();
+ LLThreadSafeRefCount(const LLThreadSafeRefCount&);
+ LLThreadSafeRefCount& operator=(const LLThreadSafeRefCount& ref)
+ {
+ if (sMutex)
+ {
+ sMutex->lock();
+ }
+ mRef = 0;
+ if (sMutex)
+ {
+ sMutex->unlock();
+ }
+ return *this;
+ }
+
+
+
+ void ref()
+ {
+ if (sMutex) sMutex->lock();
+ mRef++;
+ if (sMutex) sMutex->unlock();
+ }
+
+ S32 unref()
+ {
+ llassert(mRef >= 1);
+ if (sMutex) sMutex->lock();
+ S32 res = --mRef;
+ if (sMutex) sMutex->unlock();
+ if (0 == res)
+ {
+ delete this;
+ return 0;
+ }
+ return res;
+ }
+ S32 getNumRefs() const
+ {
+ return mRef;
+ }
+
+private:
+ S32 mRef;
+};
+
+#else
+ // New code - This was from https://bitbucket.org/lindenlab/viewer-cat/commits/b03bb43e4ead57f904cb3c1e9745dc8460de6efc
+ // and attempts
+
class LL_COMMON_API LLThreadSafeRefCount
{
public:
@@ -263,7 +328,7 @@ public:
// so that two threads who get into the if in parallel
// don't both attempt to the delete.
//
- mRef--;
+ mRef--; // Simon: why not if (mRef == 1) delete this; ? There still seems to be a window where mRef could be modified
if (mRef == 0)
delete this;
if (sMutex) sMutex->unlock();
@@ -280,6 +345,7 @@ public:
private:
LLAtomic32< S32 > mRef;
};
+#endif // new code
/**
* intrusive pointer support for LLThreadSafeRefCount
diff --git a/indra/llplugin/slplugin/CMakeLists.txt b/indra/llplugin/slplugin/CMakeLists.txt
index 03412d95d5..5d2b1d922e 100644
--- a/indra/llplugin/slplugin/CMakeLists.txt
+++ b/indra/llplugin/slplugin/CMakeLists.txt
@@ -53,6 +53,9 @@ add_executable(SLPlugin
set_target_properties(SLPlugin
PROPERTIES
MACOSX_BUNDLE_INFO_PLIST ${CMAKE_CURRENT_SOURCE_DIR}/slplugin_info.plist
+if (WINDOWS)
+ LINK_FLAGS_DEBUG "/NODEFAULTLIB:\"LIBCMTD\""
+endif (WINDOWS)
)
target_link_libraries(SLPlugin
diff --git a/indra/llui/llmodaldialog.h b/indra/llui/llmodaldialog.h
index 4e09d11d77..f81273b96a 100644
--- a/indra/llui/llmodaldialog.h
+++ b/indra/llui/llmodaldialog.h
@@ -40,7 +40,7 @@ class LLModalDialog : public LLFloater
{
public:
LLModalDialog( const LLSD& key, BOOL modal = true );
- /*virtual*/ ~LLModalDialog();
+ virtual ~LLModalDialog();
/*virtual*/ BOOL postBuild();