ThreadBoard ArchivesSite FeaturesActiveworlds SupportHistoric Archives |
Bye bye blackbird...no not the application the bird! (Sdk)
Bye bye blackbird...no not the application the bird! // Sdkabbot pabisokoFeb 6, 1999, 10:35pm
Ive got some multiple instance confusion going on here...I can seem to
kill my bird without killing the application... heres were it seems to be troubled(AW_CHAT_MESSAGE handle): if (aw_instance() == birde) { if (strncmp(message, "BYE BYE BLACKBIRD", 14) == 0) { aw_instance_set(birde); aw_destroy(); } } I get the dreaded 'Memory oculd not be "read"' message and then the application dies...anybody have an idea on hwo to fix this? walter knupeFeb 7, 1999, 9:42am
Are you sure its this section that gives trouble ? it seems fine to me. have
the bird say "i am leaving" before its aw_destroy() so you can see if it reaches the destroy line or not. Walter aka Faber Abbot Pabisoko schrieb in Nachricht <36bcdfd3.0 at homer>... > Ive got some multiple instance confusion going on here...I can seem to >kill my bird without killing the application... > >heres were it seems to be troubled(AW_CHAT_MESSAGE handle): > > if (aw_instance() == birde) > { > if (strncmp(message, "BYE BYE BLACKBIRD", 14) == 0) > { > aw_instance_set(birde); > aw_destroy(); > } > } > >I get the dreaded 'Memory oculd not be "read"' message and then the >application dies...anybody have an idea on hwo to fix this? > > abbot pabisokoFeb 7, 1999, 7:32pm
I changed the code so now it looks like this:
if (aw_instance() == birde) { if (strncmp(message, "BYE BYE BLACKBIRD", 14) == 0) { aw_instance_set(birde); aw_say("SQUAAWWWWKK!"); aw_destroy(); } } the bird squawks, then I get that message again...maybe im missing a parameter in aw_destroy or something... [View Quote] decastro@cable.a2000.nl (xelag)Feb 8, 1999, 7:17am
Abbot, my solution in Delphi is to put birde back to zero once
destroyed. Then, in the main loop, you test: If birde is different to zero, call the birde routines, otherwise skip them. If you call them when there is no "birde" defined (you just destroyed it), then you crash the program. XelaG. On Sun, 7 Feb 1999 16:32:31 -0500, "Abbot Pabisoko" [View Quote] >I changed the code so now it looks like this: > > if (aw_instance() == birde) > { > if (strncmp(message, "BYE BYE BLACKBIRD", 14) == 0) > { > aw_instance_set(birde); > aw_say("SQUAAWWWWKK!"); > aw_destroy(); > } > } > >the bird squawks, then I get that message again...maybe im missing a >parameter in aw_destroy or something... > > [View Quote] -- Xelagot 46ADB [Delph] creator: XelaG email: decastro at cable.a2000.nl roland vilettFeb 8, 1999, 7:45am
It is an error to call aw_destroy() from within a callback. You are killing
the instance out from under the SDK while it is still processing events for it. Sorry, this was not documented clearly in the SDK docs. I will update them. Arguably, the SDK should be able to handle this case, however that would involve a significant amount of work. Perhaps in a future version... -Roland [View Quote] |