Which one's better to work with? Creating and Destroying, at least?
I have a program where I allocate 3 64k handles (using globals), work with
them a little, and when I choose "quit" off my menu, I crash into macsbugs.
What's funny is I've been through it with the debugger, and it doesn't
crash when deallocating the handles, it crashes on the FN call itself?!?!
I've only been able to consider the possibility that the allocating and
playing with of handles are doing this; it never ever crashed before i
tried using global handles.
So my assumption is to instead allocate pointers, because I seem to never
work with the actual handles I'm allocating anyway??? I'm always working
with the pointer (ie. gPointer& = PEEK WORD(gHandle&))
Or is it possible that i'll see the exact same crashes no matter what?
And how do I work with pointers as compared to working with handles?
Usually, I:
allocate:
gameImg1& = FN NEWHANDLE _clear(65536) 'Rom(64k)
gameImg2& = FN NEWHANDLE _clear(65536) 'Rom(64k)
CharImg1& = FN NEWHANDLE _clear(65536) 'Char Rom(64k)
get the pointers:
gameImg1Ptr& = PEEK LONG(gameImg1&)
gameImg2Ptr& = PEEK LONG(gameImg2&)
CharImg1Ptr& = PEEK LONG(CharImg1&)
lock the handles(using HLOCK)
write the data:
READ FILE #1,gameImg1Ptr&,size&
unlock the handles(using HUNLOCK)
kill the handles:
Oserr%=FN DISPOSHANDLE(CharImg1&)
Oserr%=FN DISPOSHANDLE(gameImg2&)
Oserr%=FN DISPOSHANDLE(gameImg1&)
But I crash just when calling the FN that kills the handles; I don't even
get one line into it...!
So, are pointers better?!?
~ An FB revolution? I am there! ~
-- TJ Grant (tatewake@...)
Inspired Software. http://inspired.netstreet.net/
Macintosh, Dos, Windows, and BeOS software solutions.
Phone: 407-728-7563
....................................
.MacSloMo: 6502 emulation in FB! .
.http://inspired.netstreet.net/POC/.
....................................