jpgloader crashes my app

BlitzMax Forums/Brucey's Modules/jpgloader crashes my app

SB(Posted 2009) [#1]
*edit [NOT A BUG]

today i stumbled upon a weird behavior of jpgloader.bmx when used together with the bah.freeimage mod.

i was trying to do this
	Local mainWin_Icons:TPixmap = LoadPixmap("toolbar.bmp")


which worked quite fine until i imported bah.freeimage. with freeimage the app would just crash with a windows "stopped working" message. after removing freeimage it would run fine. after some debugging the error seems to happen during the testing of the different loaders in jpgloader.bmx on line 65:
Local res=loadjpg(stream,readfunc,width,height,depth,pix)

which calls a function from libjpeg.bmx which is a binding to a c function somewhere in that lib.

in my opinion importing freeimage somehow changes the order of the pixmap loaders for the different file formats are tested so the jpgloader gets my bitmap data and crashes. perhaps without adding freeimage the bitmaploader gets tested before the jpgloader so the bitmap data never reaches the jpgloader. but actually i am not sure of this.

all i know is that my code works with a bitmapfile without importing freeimage and works not with importing freeimage. however with an pngfile it works, whether i am importing freeimage or not.

Here some code to test:





Brucey(Posted 2009) [#2]
This is not a bug.

This is due to having two conflicting versions of libjpeg in the same binary.

If you want to use BaH.FreeImage, you shouldn't import any of the built-in image loaders.