Menu

#5 System_Shutdown() crashes if windowed/fullscreen is toggled

v1.53
pending-postponed
nobody
Engine (7)
5
2011-08-26
2006-02-01
No

To replicate the problem:
1. Start the program in fullscreen mode.
2. Change HGE_WINDOW system state to true.
3. Close the program.

System_Shutdown() will crash during the DestroyWindow()
function call. I've tracked down the problem to
system.cpp, around the following line:

if(hwnd)
{
//ShowWindow(hwnd, SW_HIDE);
//SetWindowLong(hwnd, GWL_EXSTYLE,
GetWindowLong(hwnd, GWL_EXSTYLE) | WS_EX_TOOLWINDOW);
//ShowWindow(hwnd, SW_SHOW);
DestroyWindow(hwnd);
hwnd=0;
}

Discussion

  • Stinger

    Stinger - 2006-02-02

    Logged In: YES
    user_id=1379046

    Hmmm... My App never crash, because I use HGE_EXITFUNC for
    correct shutdown.

    bool QuitFlag = false;

    void ToggleScreen()
    {
    if (hge->Input_GetKeyState(HGEK_ALT) &&
    hge->Input_GetKey() == HGEK_ENTER)
    hge->System_SetState(HGE_WINDOWED,
    !(hge->System_GetState(HGE_WINDOWED)).bool_value);
    }

    bool QuitQuery(void)
    {
    QuitFlag = true;
    return false;
    }

    bool FrameFunc(void)
    {
    ToggleScreen();
    ...
    // Logic & Render
    ...
    return QuitFlag;
    }

    //...WinMain...
    hge->System_SetState(HGE_EXITFUNC, QuitQuery);
    hge->System_SetState(HGE_FRAMEFUNC, FrameFunc);
    //...

    Maybe engine need same flag as QuitFlag as easy solution?

     
  • Pedro Luchini

    Pedro Luchini - 2006-02-04

    Logged In: YES
    user_id=1330669

    stingerx,

    I use that same strategy (a "quit flag" which is set to true
    in the exitFunc).

     
  • Stinger

    Stinger - 2011-08-26
    • status: open --> pending-postponed
     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.