From b69573f50496f9cdcad2bff5e5e25bf1ecea94e6 Mon Sep 17 00:00:00 2001
From: gwaldron <gwaldron@gmail.com>
Date: Mon, 17 Oct 2016 08:04:31 -0400
Subject: [PATCH] Removed/patched deprecated called to osg::Referenced
 thread-safe reference counting

---
 src/osgEarth/Locators.cpp   | 4 ++--
 src/osgEarth/Registry.cpp   | 3 +++
 src/osgEarth/TileSource.cpp | 2 --
 3 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/src/osgEarth/Locators.cpp b/src/osgEarth/Locators.cpp
index fb3e825..fcb780c 100644
--- a/src/osgEarth/Locators.cpp
+++ b/src/osgEarth/Locators.cpp
@@ -29,7 +29,7 @@ _inverseCalculated(false),
 _x0(0.0), _x1(1.0),
 _y0(0.0), _y1(1.0)
 {
-    this->setThreadSafeRefUnref(true);
+    //nop
 }
 
 GeoLocator::GeoLocator( const GeoExtent& dataExtent ) :
@@ -38,7 +38,7 @@ _dataExtent( dataExtent ),
 _x0(0.0), _x1(1.0),
 _y0(0.0), _y1(1.0)
 {
-    this->setThreadSafeRefUnref(true);
+    //nop
 }
 
 GeoLocator::GeoLocator( const osgTerrain::Locator& prototype, const GeoExtent& dataExtent ) :
diff --git a/src/osgEarth/Registry.cpp b/src/osgEarth/Registry.cpp
index 32a9439..bf95e87 100644
--- a/src/osgEarth/Registry.cpp
+++ b/src/osgEarth/Registry.cpp
@@ -694,7 +694,10 @@ class RegisterEarthTileExtension
 public:
     RegisterEarthTileExtension()
     {
+#if OSG_VERSION_LESS_THAN(3,5,4)
+        // Method deprecated beyone 3.5.4 since all ref counting is thread-safe by default
         osg::Referenced::setThreadSafeReferenceCounting( true );
+#endif
         osgDB::Registry::instance()->addFileExtensionAlias("earth_tile", "earth");
     }
 };
diff --git a/src/osgEarth/TileSource.cpp b/src/osgEarth/TileSource.cpp
index fcdf2b8..28c6f61 100644
--- a/src/osgEarth/TileSource.cpp
+++ b/src/osgEarth/TileSource.cpp
@@ -218,8 +218,6 @@ _status ( Status::Error("Not initialized") ),
 _mode   ( 0 ),
 _openCalled( false )
 {
-    this->setThreadSafeRefUnref( true );
-
     // Initialize the l2 cache size to the options.
     int l2CacheSize = *options.L2CacheSize();
 
