[Clam-devel] fix use of empty OutControlArray

Zach Welch zach-clam-devel at splitstring.com
Sun Apr 1 16:50:42 PDT 2007


Hi all,

I found that the following trivial test case causes a bad assert in 
OutControlArray.  The subsequent "one-line" patch cures the problem.

Cheers,

Zach

% cd ..../clam-bin
% cat >test.cxx
#include <CLAM/OutControlArray.hxx>
int main() { CLAM::OutControlArray array; return 0; }
% gcc -o test test.cxx -I include -L lib -lclam_core -lclam_processing -ldl
% LD_LIBRARY_PATH=lib ./test
##########################################################
################### ASSERTION FAILED #####################
##########################################################
At file core/src/OutControlArray.cxx line 88
OutControlArray::Cannot Shrink a Control Array to a larger size
[...snip...]
Aborted


Index: CLAM/src/Flow/Controls/OutControlArray.cxx
===================================================================
--- CLAM/src/Flow/Controls/OutControlArray.cxx  (revision 9909)
+++ CLAM/src/Flow/Controls/OutControlArray.cxx  (working copy)
@@ -46,7 +46,8 @@

 OutControlArray::~OutControlArray()
 {
-       Shrink(0);
+       if (mControls.size())
+               Shrink(0);
 }






More information about the clam-devel mailing list