From e385ba8adb0c77fea20c58c45b966193c23a4570 Mon Sep 17 00:00:00 2001 From: Stefan Radomski Date: Wed, 6 Mar 2013 19:48:20 +0100 Subject: Fixed a concurrency related issue --- apps/samples/vrml-server.scxml | 3 ++- .../plugins/invoker/graphics/openscenegraph/OSGConverter.cpp | 10 ++++++++-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/apps/samples/vrml-server.scxml b/apps/samples/vrml-server.scxml index bf0e4f6..7c257f5 100644 --- a/apps/samples/vrml-server.scxml +++ b/apps/samples/vrml-server.scxml @@ -21,7 +21,8 @@ '_' + numPattern + // z '_' + numPattern + // width '_' + numPattern + // height - '_(off|on)' + ')\\..*$'); // autorotate + '_(off|on)' + // autorotate + ')\\.\\w+$'); // end /** * Transform a file we found into a processed or model struct diff --git a/src/uscxml/plugins/invoker/graphics/openscenegraph/OSGConverter.cpp b/src/uscxml/plugins/invoker/graphics/openscenegraph/OSGConverter.cpp index 2fa2877..fbc244a 100644 --- a/src/uscxml/plugins/invoker/graphics/openscenegraph/OSGConverter.cpp +++ b/src/uscxml/plugins/invoker/graphics/openscenegraph/OSGConverter.cpp @@ -502,9 +502,15 @@ void OSGConverter::dumpMatrix(const osg::Matrix& m) { } void OSGConverter::NameRespectingWriteToFile::operator()(const osg::Image& image, const unsigned int context_id) { - bool success = osgDB::writeImageFile(image, _filename); + + bool success = osgDB::writeImageFile(image, _filename + ".tmp"); if (success) { - _converter->reportSuccess(_req); + int err = rename(std::string(_filename + ".tmp").c_str(), _filename.c_str()); + if (err) { + _converter->reportFailure(_req); + } else { + _converter->reportSuccess(_req); + } } else { _converter->reportFailure(_req); } -- cgit v0.12