blitz3d bug

Blitz3D Forums/Blitz3D Programming/blitz3d bug

bytecode77(Posted 2006) [#1]
hello!

i am actually working on a gui, which loads following image:


this code doesn't work...i get a memory acces violation in "loadanimimage"
app\Img_TabPage = LoadAnimImage("TabPage.png", 4, app\TabPage_Height, 0, 15): MaskImage app\Img_TabPage, 255, 0, 255


but if i replace this with:

FreeImage LoadImage("TabPage.png")
app\Img_TabPage = LoadAnimImage("TabPage.png", 4, app\TabPage_Height, 0, 15): MaskImage app\Img_TabPage, 255, 0, 255


everything works!?!

with one image, it works without the
freeimage loadimage("...")

and with the other image it works, but both images are THE SAME!


OJay(Posted 2006) [#2]
are you sure app\TabPage_Height is non-zero?

and

you should test if loadanimimage() succeeded, before calling maskimage...

If app\Img_TabPage <> 0 Then MaskImage app\Img_TabPage, 255, 0, 255



n8r2k(Posted 2006) [#3]
i wouldn't make the height variable at all. If the height remains static always, then i would just enter a value for the height instead of a variable


John Blackledge(Posted 2006) [#4]
FreeImage is not used like that - (FreeImage LoadImage("TabPage.png"))
You need to do FreeImage app\Img_TabPage, if app\Img_TabPage is > 0.


bytecode77(Posted 2006) [#5]
app\TabPage_Height = XGui_ImageHeight2("TabPage.png")

Function XGui_ImageHeight2(path$)
img = LoadImage(path$)
If img = 0 Then RuntimeError "Image " + path$ + " not found."
h = ImageHeight(img)
FreeImage img
Return h
End Function


why does it work with the on image, and not with the other?


GfK(Posted 2006) [#6]
Turn Debug on, and you'll get a more helpful error message than "memory access violation".


bytecode77(Posted 2006) [#7]
my debugger was on, and in loadanimimage was "memory acces violation", too...


jfk EO-11110(Posted 2006) [#8]
Like John said this:
FreeImage LoadImage("TabPage.png")
doesn't make sense. It will load the image and free it immediately.

Not sure why this makes the other command work. I guess there's something wrong with the last 2 parameters.


Sir Gak(Posted 2006) [#9]
As you know, LoadImage and LoadAnimImage are not the same command.


jfk EO-11110(Posted 2006) [#10]
it would be helpful when you post the image here.


Barliesque(Posted 2006) [#11]
I would imagine that although your FreeImage statement is immediately freeing the image right after it's been loaded... that it's still in memory. This is, after all, just a convention of the Blitz3D engine. So when you immediately load the image again, it's probably not reloading the image, but simply removing a "free" flag.

Maybe the LoadImage command loads the file differently or makes some sort of adjustment to it, so that when LoadAnimImage looks at it already in memory, there's no problem.

I don't suppose your PNG image is interlaced, is it?


bytecode77(Posted 2006) [#12]
with the png is everything ok...


MR2007(Posted 2006) [#13]
No, your png isn't ok.
  TabPage_Height = XGui_ImageHeight2("test.png")

  Print TabPage_Height
  WaitKey()

  Function XGui_ImageHeight2(path$)
   img = LoadImage(path$)
   If img = 0 Then RuntimeError "Image " + path$ + " not found."
   h = ImageHeight(img)
   FreeImage img
   Return h
  End Function

Test this, it works with every Image.


bytecode77(Posted 2006) [#14]
yes, it works...


bytecode77(Posted 2006) [#15]
but this error appears very often...

for example:
everything works, and if i cange

type XGui_Application
field ...
end type

into:

type XGui_Application
field ...
field abcd
end type

the error appears again...


MR2007(Posted 2006) [#16]
Sure, you habe enabled Debugger? Memory Access Violation isn't normal.
Is a Function maybe called like that?


bytecode77(Posted 2006) [#17]
yes, its really strange....
i change a thing that dont have to crash an other command, but it does... and my debugger is on, this must be a bug of bb

marksibly? are u here?


MR2007(Posted 2006) [#18]
I don't think it's a bug of bb. Can you give a sample which shows the bug?


Stevie G(Posted 2006) [#19]
Yes, show us some more code + the image , never had any issues with Blitz in this respect.

Which version of Blitz are you using? I think there was a few issues with a recent version.

Stevie


bytecode77(Posted 2006) [#20]
if i show you the a bit of the code it dont work...

everythig works, but if i change

type XGui_Application
field ...
end type

into:

type XGui_Application
field ...
field abcd
end type

the error appears


Stevie G(Posted 2006) [#21]
There is no way that simply adding a field into the type declaration would cause a MAV. Is it a different error you're getting? To me it seems that you must be doing something wrong elsewhere and it's very unlikely to be a BB bug. Can you post the code in it's entirety and e-mail the image or upload it?

Help us help you.

Stevie


bytecode77(Posted 2006) [#22]
i am adding a field to a type which isnt needed anywhere and it causes a memory acces violation...that MUST BE a bug of bb....


Stevie G(Posted 2006) [#23]

i am adding a field to a type which isnt needed anywhere and it causes a memory acces violation...that MUST BE a bug of bb....



Nonsense, there is no way that this is causing a MAV. Like I said the issue must be elsewhere!

You are not making it easy for anyone trying to help you. Unless you can provide more code ( a short working example of your issue ) and your image then you're on your own mate.

Just a thought ... is it possible that you are using a floating point reference instead of an integer reference to your image?

Stevie


Sir Gak(Posted 2006) [#24]
MAV usually comes up when you try to use a graphic file that isn't loaded into memory. Have you checked your load to see if you have a non-zero result (a zero result means your load failed). Also, maybe, for whatever reason, your TYPE field "app\Img_TabPage" isn't valid at the point in your prog where you are attempting to do the load (ie not initialized yet?).


bytecode77(Posted 2006) [#25]
i'll give it up -.-


skidracer(Posted 2006) [#26]
I beleive you!

Is it possible for you to email the entire project to me here at Blitz Research? If I can reproduce it here I'm sure Mr Sibly can take a look...


bytecode77(Posted 2006) [#27]
ok, please give me your email...
but don't use my project...its not ready yet:)

thx


Stevie G(Posted 2006) [#28]
.. double post


Stevie G(Posted 2006) [#29]
@ DevilsChild .. check Skids signature for e-mail address. Hope you get it sorted .. whatever the problem is.

Stevie

p.s. Can you let us all know for future reference?


bytecode77(Posted 2006) [#30]
yes, i'll let you know, i'm writing now to him...