blitz3d bug
Blitz3D Forums/Blitz3D Programming/blitz3d bug
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!
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
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
FreeImage is not used like that - (FreeImage LoadImage("TabPage.png"))
You need to do FreeImage app\Img_TabPage, if app\Img_TabPage is > 0.
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 Functionwhy does it work with the on image, and not with the other?
Turn Debug on, and you'll get a more helpful error message than "memory access violation".
my debugger was on, and in loadanimimage was "memory acces violation", too...
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.
As you know, LoadImage and LoadAnimImage are not the same command.
it would be helpful when you post the image here.
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?
with the png is everything ok...
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.
yes, it works...
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...
Sure, you habe enabled Debugger? Memory Access Violation isn't normal.
Is a Function maybe called like that?
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?
I don't think it's a bug of bb. Can you give a sample which shows the bug?
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
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
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
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....
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
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?).
i'll give it up -.-
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...
ok, please give me your email...
but don't use my project...its not ready yet:)
thx
.. double post
@ 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?
yes, i'll let you know, i'm writing now to him...