summaryrefslogtreecommitdiff
path: root/cpp/src/slice2cpp/Gen.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'cpp/src/slice2cpp/Gen.cpp')
-rw-r--r--cpp/src/slice2cpp/Gen.cpp9
1 files changed, 4 insertions, 5 deletions
diff --git a/cpp/src/slice2cpp/Gen.cpp b/cpp/src/slice2cpp/Gen.cpp
index 8f49c312083..cba5e59e7ad 100644
--- a/cpp/src/slice2cpp/Gen.cpp
+++ b/cpp/src/slice2cpp/Gen.cpp
@@ -2920,8 +2920,7 @@ Slice::Gen::ObjectVisitor::emitGCFunctions(const ClassDefPtr& p)
C << sp << nl << "void" << nl << scoped.substr(2) << "::__incRef()";
C << sb;
C << nl << "IceUtil::gcRecMutex._m->lock();";
- C << nl << "assert(_ref >= 0);";
- C << nl << "if(_ref == 0)";
+ C << nl << "if(__getRefUnsafe() == 0)";
C << sb;
C.zeroIndent();
C << nl << "#ifdef NDEBUG // To avoid annoying warnings about variables that are not used...";
@@ -2936,7 +2935,7 @@ Slice::Gen::ObjectVisitor::emitGCFunctions(const ClassDefPtr& p)
C << nl << "#endif";
C.restoreIndent();
C << eb;
- C << nl << "++_ref;";
+ C << nl << "__incRefUnsafe();";
C << nl << "IceUtil::gcRecMutex._m->unlock();";
C << eb;
@@ -2946,8 +2945,8 @@ Slice::Gen::ObjectVisitor::emitGCFunctions(const ClassDefPtr& p)
C << sb;
C << nl << "IceUtil::gcRecMutex._m->lock();";
C << nl << "bool doDelete = false;";
- C << nl << "assert(_ref > 0);";
- C << nl << "if(--_ref == 0)";
+ C << nl << "__decRefUnsafe();";
+ C << nl << "if(__getRefUnsafe() == 0)";
C << sb;
C << nl << "doDelete = !_noDelete;";
C << nl << "_noDelete = true;";