Bug in gflSoften? Getting AVs

Discussions on GFL SDK, the graphic library for reading and writing graphic files

Moderators: XnTriq, xnview

Post Reply
User avatar
MaierMan
Posts: 78
Joined: Wed Aug 04, 2004 8:32 pm
Contact:

Bug in gflSoften? Getting AVs

Post by MaierMan » Mon Nov 22, 2004 10:35 pm

Me again :P

I recently upgraded most of my programs to use GflSDK2.20.
One of my Applications (SimilarImages - that dupe checker), now crashes whenever it comes to the dataset generation routines.
I just recompiled and linked against Version 2.20... After switching back to 2.11 it everything works well again.

I traced the call stack and it seems gflSoften "started" an Access Violation that then will be raised in later gflFunction calls.
Although it is no problem to call gflSaveBitmap right after gflSoften.

My code is (Borland C++Builder6 fully patched, C++, Win32 (XP Pro SP1 Box)):

Code: Select all

void __fastcall ApplyFilters(GFL_BITMAP **BMP)
{
        gflEqualizeOnLuminance(*BMP, NULL);
        /* "Working" (means, not complaining about failures) but introducing the crash */
        gflSoften(*BMP, NULL, 33);
        /* Crash  */
        gflNormalize(*BMP, NULL);
        gflAutoCrop(*BMP, NULL, NULL, 85);
}
I furthermore tried to get it running using the 2nd Parameter to "Soften" it to another image and pull it back afterwards.
Didnt work too.
(running it for debugging in apps main thread)

Another testcase performed by a MSVC 6 (SPs + ProcessorPack) build...
Simplied version of what I do in my application until it crashes.

Code: Select all

// gflsoftentest.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"
#include "libgfl.h"
#include "libgfle.h"

void ApplyFilters(GFL_BITMAP **BMP)
{
        gflEqualizeOnLuminance(*BMP, NULL);
        gflSoften(*BMP, NULL, 33);
        gflNormalize(*BMP, NULL); // crashes
        gflAutoCrop(*BMP, NULL, NULL, 85); // crashes (when gflNormalize is commented out)
}

int main(int argc, char* argv[])
{
	
	gflLibraryInit();
	gflEnableLZW(GFL_TRUE);

	GFL_BITMAP *BMP;
	GFL_FILE_INFORMATION fileinfo;
	GFL_LOAD_PARAMS params;
	GFL_SAVE_PARAMS sparams;
    
	gflGetDefaultThumbnailParams(&params);
	params.Flags |=
		GFL_LOAD_HIGH_QUALITY_THUMBNAIL
		| GFL_LOAD_SKIP_ALPHA
		| GFL_LOAD_PREVIEW_NO_CANVAS_RESIZE
		| GFL_LOAD_FORCE_COLOR_MODEL
	;
	params.ColorModel = GFL_RGB;

	gflGetDefaultSaveParams(&sparams);
	sparams.FormatIndex = gflGetFormatIndexByName("jpeg");
	
	gflLoadThumbnail(
		"test.jpg",
		420,
		420,
		&BMP,
		&params,
		&fileinfo
    );

	gflSaveBitmap(
		"th1.jpg",
		BMP,
		&sparams
	);

	ApplyFilters(&BMP);
	
	gflSaveBitmap(
		"th2.jpg",
		BMP,
		&sparams
	);

	gflFreeBitmap(BMP);
	gflFreeFileInformation(&fileinfo);

	gflLibraryExit();
	return 0;
}
Same AVs.
(But works without gflSoften call)

Cheers
Nils

User avatar
xnview
Author of XnView
Posts: 33169
Joined: Mon Oct 13, 2003 7:31 am
Location: France
Contact:

Re: Bug in gflSoften? Getting AVs

Post by xnview » Tue Nov 23, 2004 11:33 am

MaierMan wrote: Another testcase performed by a MSVC 6 (SPs + ProcessorPack) build...
Simplied version of what I do in my application until it crashes.

Code: Select all

// gflsoftentest.cpp : Defines the entry point for the console application.
//
Same AVs.
(But works without gflSoften call)
I've tested with your code, and no crash :-(
I load a jpg RGB file.
Pierre.

User avatar
MaierMan
Posts: 78
Joined: Wed Aug 04, 2004 8:32 pm
Contact:

Re: Bug in gflSoften? Getting AVs

Post by MaierMan » Tue Nov 23, 2004 6:04 pm

xnview wrote:
MaierMan wrote: Another testcase performed by a MSVC 6 (SPs + ProcessorPack) build...
Simplied version of what I do in my application until it crashes.

Code: Select all

// gflsoftentest.cpp : Defines the entry point for the console application.
//
Same AVs.
(But works without gflSoften call)
I've tested with your code, and no crash :-(
I load a jpg RGB file.
I checked the same code again with MSVC7 (.Net) this time.
And it crashes...
Maybe it's something on my box?
I both times used the your distributed .libs and RELEASE config.
The dlls are located in my sys32 dir (not in the project dir)...
Thats all I currently can say...
Always the same Message:
Unhandled exception at 0x10004a8c in gflsoftentest.exe: 0xC0000005: Access violation writing location 0x00130110.
That test case project (incl. the test jpg and the compiled exe) is available here:
http://celebnamer.celebworld.ws/xnview/ ... entest.rar

Ill do some debugging now...
And see if I get some more information by watching the memory allocations (LibraryInitEx).
(But I never was a champ when it comes to debugging ROFL)

User avatar
xnview
Author of XnView
Posts: 33169
Joined: Mon Oct 13, 2003 7:31 am
Location: France
Contact:

Re: Bug in gflSoften? Getting AVs

Post by xnview » Tue Nov 23, 2004 7:57 pm

MaierMan wrote:I checked the same code again with MSVC7 (.Net) this time.
And it crashes...
Maybe it's something on my box?
I both times used the your distributed .libs and RELEASE config.
The dlls are located in my sys32 dir (not in the project dir)...
With your code and Visual C++ 6, no crash :-(
Strange, my system is Win2K. Do you have the problem with all pictures?
Pierre.

User avatar
MaierMan
Posts: 78
Joined: Wed Aug 04, 2004 8:32 pm
Contact:

Re: Bug in gflSoften? Getting AVs

Post by MaierMan » Tue Nov 23, 2004 8:44 pm

xnview wrote:
MaierMan wrote:I checked the same code again with MSVC7 (.Net) this time.
And it crashes...
Maybe it's something on my box?
I both times used the your distributed .libs and RELEASE config.
The dlls are located in my sys32 dir (not in the project dir)...
With your code and Visual C++ 6, no crash :-(
Strange, my system is Win2K. Do you have the problem with all pictures?
I tested various files (but only jpg files I have to admit).
Always the same AVs.

Furthermore I gave the EXE to a buddy that runs XP too...
The program crashes (without notice... No Debugger on that system).
th1.jpg was created... but no th2.jpg

User avatar
xnview
Author of XnView
Posts: 33169
Joined: Mon Oct 13, 2003 7:31 am
Location: France
Contact:

Re: Bug in gflSoften? Getting AVs

Post by xnview » Wed Nov 24, 2004 2:23 pm

MaierMan wrote:
xnview wrote:
MaierMan wrote:I checked the same code again with MSVC7 (.Net) this time.
And it crashes...
Maybe it's something on my box?
I both times used the your distributed .libs and RELEASE config.
The dlls are located in my sys32 dir (not in the project dir)...
With your code and Visual C++ 6, no crash :-(
Strange, my system is Win2K. Do you have the problem with all pictures?
I tested various files (but only jpg files I have to admit).
Always the same AVs.

Furthermore I gave the EXE to a buddy that runs XP too...
The program crashes (without notice... No Debugger on that system).
th1.jpg was created... but no th2.jpg
Ok, right. With current beta, i've not the bug.
Pierre.

User avatar
MaierMan
Posts: 78
Joined: Wed Aug 04, 2004 8:32 pm
Contact:

Re: Bug in gflSoften? Getting AVs

Post by MaierMan » Wed Nov 24, 2004 6:36 pm

xnview wrote:Ok, right. With current beta, i've not the bug.
Yep...
Compiled and linked well.
Execution succeeded without problems (for my testcase).

Thx for the fast fix!
Will you release new version soon?
Or will you release a version 2.21?

User avatar
xnview
Author of XnView
Posts: 33169
Joined: Mon Oct 13, 2003 7:31 am
Location: France
Contact:

Re: Bug in gflSoften? Getting AVs

Post by xnview » Wed Nov 24, 2004 7:57 pm

MaierMan wrote:
xnview wrote:Ok, right. With current beta, i've not the bug.
Yep...
Compiled and linked well.
Execution succeeded without problems (for my testcase).

Thx for the fast fix!
Will you release new version soon?
Or will you release a version 2.21?
Currently beta, perhaps release in december.
Pierre.

Post Reply