Welcome, Guest. Please login or register.

Author Topic: Pixel isn't drawn  (Read 2017 times)

Description:

0 Members and 1 Guest are viewing this topic.

Offline Piru

  • \' union select name,pwd--
  • Hero Member
  • *****
  • Join Date: Aug 2002
  • Posts: 6946
    • Show all replies
    • http://www.iki.fi/sintonen/
Re: Pixel isn't drawn
« on: October 25, 2010, 04:14:36 PM »
Quote from: Omega Space Protons;586945
and in the cleanup function:
Code: [Select]
void clean_up(void)
{
 
    /* If thw window is open, close it */
    if(GameWindow != NULL)
    {
        CloseWindow(GameWindow);
    }
 
    /* If the intuition.library is open, close it */
    if(IntuitionBase != NULL)
    {
        CloseLibrary((struct Library *)IntuitionBase);
    }
 
    /* If the graphics.library is open, close it */
    if(GfxBase != NULL)
    {
        CloseLibrary((struct Library *)GfxBase);
    }

    ReleasePen(GameWindow->WScreen->ViewPort.ColorMap, blue);
 
    return;
}
You're referencing a dangling pointer here. GameWindow is a pointer to released memory (CloseWindow() has already released the memory at this point). Thus you will get a random WScreen pointer and further pain.

Depending on your luck it might crash only occasionally. It much depends on how busy your system is.