diff --git a/src/osgPlugins/curl/ReaderWriterCURL.cpp b/src/osgPlugins/curl/ReaderWriterCURL.cpp index ff2984bf6..afcf65817 100644 --- a/src/osgPlugins/curl/ReaderWriterCURL.cpp +++ b/src/osgPlugins/curl/ReaderWriterCURL.cpp @@ -22,7 +22,7 @@ #include #include -class EasyCurl +class EasyCurl : public osg::Referenced { public: @@ -50,6 +50,8 @@ class EasyCurl EasyCurl() { + osg::notify(osg::INFO)<<"EasyCurl::EasyCurl()"< > ThreadCurlMap; - mutable EasyCurl _easyCurl; + EasyCurl& getEasyCurl() const + { + OpenThreads::ScopedLock lock(_threadCurlMapMutex); + + osg::ref_ptr& ec = _threadCurlMap[OpenThreads::Thread::CurrentThread()]; + if (!ec) ec = new EasyCurl; + + return *ec; + } + + mutable OpenThreads::Mutex _threadCurlMapMutex; + mutable ThreadCurlMap _threadCurlMap; };