When trying to convert images from one type to another using convertDataTypeTo() I occasionally recieve a segmentation fault. I believe that the error is caused by the following lines.

subRefCP(dest);
return ((getData() && !(dest->getData())) ? true : false);

It is not valid to call dest->getData() after the reference count has been decreased to zero. I have attached a patch for OSGImage.cpp that fixes this problem


Thanks,
Aron
Index: OSGImage.cpp
===================================================================
RCS file: /cvsroot/opensg/OpenSG/Source/System/Image/OSGImage.cpp,v
retrieving revision 1.42
diff -u -r1.42 OSGImage.cpp
--- OSGImage.cpp        6 Jul 2005 15:32:19 -0000       1.42
+++ OSGImage.cpp        7 Jul 2005 20:32:02 -0000
@@ -1969,7 +1969,7 @@
         subRefCP(dest);
     }
 
-    return ((getData() && !(dest->getData())) ? true : false);
+    return (getData() ? true : false);
 }
 
 /*! It just fills the hole image data with the given pixel value. It is

Reply via email to