gflFreeBitmapData stack overflow ?
Posted: Fri Mar 14, 2008 9:47 am
Hello !
I am using the gfllib with a C# wrapper, and there are a few points that I would like to be explained a bit further:
- When I call gflFreeBitmapData, I sometimes catch a StackOverflow exception. Is there any reason for that ? I can't see why gflFreeBitmapData could raise such an error, since its structure does not require recursive calls for freeing it.
- Another question is : What is the difference between gflFreeBitmap and gflFreeBitmapData? The first seems to set all values to 0x00000000, whereas the second sets almost all values to 0xfeeefeee. I couldn't find the answer in the Help file ("both functions free the content of the GFL_BITMAP structure").
Is there a correct way of using those ? (for instance, should I first call gflFreeBitmapData, and afterward, gflFreeBitmap ?)
here's an extract of my code :
I'll also add that info.FileSize is not always the same. Is there any reason for that?
In particular in threaded processi, if two threads attempt to load the file, both will succeed, but the info.FileSize is not the same for both threads.
I am using the gfllib with a C# wrapper, and there are a few points that I would like to be explained a bit further:
- When I call gflFreeBitmapData, I sometimes catch a StackOverflow exception. Is there any reason for that ? I can't see why gflFreeBitmapData could raise such an error, since its structure does not require recursive calls for freeing it.
- Another question is : What is the difference between gflFreeBitmap and gflFreeBitmapData? The first seems to set all values to 0x00000000, whereas the second sets almost all values to 0xfeeefeee. I couldn't find the answer in the Help file ("both functions free the content of the GFL_BITMAP structure").
Is there a correct way of using those ? (for instance, should I first call gflFreeBitmapData, and afterward, gflFreeBitmap ?)
here's an extract of my code :
Code: Select all
GFL_BITMAP bmp = new GFL_BITMAP();
GFL_ERROR err = new GFL_ERROR();
GFL_FILE_INFORMATION info = new GFL_FILE_INFORMATION();
GFL_LOAD_PARAMS ldp;
gflGetDefaultLoadParams(out ldp);
string my_file = "\\images\\bmp.bmp";
err = gflLoadBitmap(my_file, out bmp, ref ldp, ref info);
Console.WriteLine("load: " + err + " size: " + info.FileSize);
gflFreeBitmapData(ref bmp); //here is where StackOverflow occurs
gflFreeFileInformation(ref info);
gflFreeBitmap(ref bmp);
In particular in threaded processi, if two threads attempt to load the file, both will succeed, but the info.FileSize is not the same for both threads.