Author: post
Date: 2009-12-20 09:34:13 +0100 (Sun, 20 Dec 2009)
New Revision: 176

Modified:
   RawSpeed/DngDecoderSlices.cpp
   RawSpeed/DngDecoderSlices.h
Log:
Add setError to avoid settiong un-freeable error.

Modified: RawSpeed/DngDecoderSlices.cpp
===================================================================
--- RawSpeed/DngDecoderSlices.cpp       2009-12-19 14:32:35 UTC (rev 175)
+++ RawSpeed/DngDecoderSlices.cpp       2009-12-20 08:34:13 UTC (rev 176)
@@ -30,9 +30,7 @@
   try {
     parent->decodeSlice(me);
   } catch (...) {
-    pthread_mutex_lock(&parent->errMutex);
-    parent->errors.push_back("DNGDEcodeThread: Caught exception.");
-    pthread_mutex_unlock(&parent->errMutex);
+    parent->setError("DNGDEcodeThread: Caught exception.");
   }
   pthread_exit(NULL);
   return NULL;
@@ -100,13 +98,9 @@
     try {
       l.startDecoder(e.byteOffset, e.byteCount, e.offX, e.offY);
     } catch (RawDecoderException err) {
-      pthread_mutex_lock(&errMutex);
-      errors.push_back(_strdup(err.what()));
-      pthread_mutex_unlock(&errMutex);
+      setError(err.what());
     } catch (IOException err) {
-      pthread_mutex_lock(&errMutex);
-      errors.push_back("DngDecoderSlices::decodeSlice: IO error occurred, 
probably attempted to read past end of file.");
-      pthread_mutex_unlock(&errMutex);
+      setError("DngDecoderSlices::decodeSlice: IO error occurred, probably 
attempted to read past end of file.");
     }
   }
 }
@@ -115,4 +109,11 @@
   return (int)slices.size();
 }
 
+void DngDecoderSlices::setError( const char* err )
+{
+  pthread_mutex_lock(&errMutex);
+  errors.push_back(_strdup(err));
+  pthread_mutex_unlock(&errMutex);
+}
+
 } // namespace RawSpeed

Modified: RawSpeed/DngDecoderSlices.h
===================================================================
--- RawSpeed/DngDecoderSlices.h 2009-12-19 14:32:35 UTC (rev 175)
+++ RawSpeed/DngDecoderSlices.h 2009-12-20 08:34:13 UTC (rev 176)
@@ -60,6 +60,7 @@
   void addSlice(DngSliceElement slice);
   void startDecoding();
   void decodeSlice(DngDecoderThread* t);
+  void setError(const char* err);
   int size();
   queue<DngSliceElement> slices;
   vector<DngDecoderThread*> threads;


_______________________________________________
Rawstudio-commit mailing list
[email protected]
http://rawstudio.org/cgi-bin/mailman/listinfo/rawstudio-commit

Reply via email to