Opened 11 years ago

Closed 11 years ago

Last modified 11 years ago

#2115 closed defect (fixed)

psDisplayError attempts to set video mode in Atlas

Reported by: historic_bruno Owned by: ben
Priority: Should Have Milestone: Alpha 15
Component: Core engine Keywords:
Cc: Patch:

Description

Atlas currently uses the engine's error display logic (see r13724 for explanation), but this code attempts to switch fullscreen to windowed mode if necessary. This will cause problems in Atlas, where wxWidgets manages the window, see the error below for an example.

There are two possible causes of an error: 1) CVideoMode::m_IsFullscreen won't be initialized in Atlas, if started from the command line, leaving it in an undefined state, 2) if Atlas is started from within a fullscreen game, the state persists and is never reset. Atlas should have its own error handler eventually, but as a workaround we can ensure the fullscreen state is properly initialized and reset.

Function call failed: return value was -1 (Function failed (no details available))
Location: wsdl.cpp:260 (wnd_CreateWindow)

Call stack:

wnd_CreateWindow (wsdl.cpp:260)
    w = (unavailable)
    h = 768 (0x00000300)
    wc = 
        style = 32 (0x00000020)
        lpfnWndProc = 0x0139D8F0 -> (OnMessage)
        cbClsExtra = 0 (0x00000000)
        cbWndExtra = 0 (0x00000000)
        hInstance = 0x011D0000 (..)
        hIcon = 0x00000000
        hCursor = 0x00000000
        hbrBackground = 0x00000000
        lpszMenuName = 0x00000000
        lpszClassName = 0x01451A98 -> "WSDL{55752F43-0241-492C-8648-C7243397FCE4}"

    class_atom = 0 (0x0000)

SDL_SetVideoMode (wsdl.cpp:398)
    w = 1024 (0x00000400)
    h = 768 (0x00000300)
    bpp = 32 (0x00000020)
    flags = 2 (0x00000002)
    screen = { format = 0x014A3C44 -> { BitsPerPixel = [8] { 32 (0x20), 0 (0x00), 0 (0x00), 0 (0x00), 0 (0x00), 0 (0x00), 0 (0x00), 0 (0x00) } }, w = 1920 (0x00000780), h = 1200 (0x000004B0) }
    format = { BitsPerPixel = 32 (0x20) }
    s = 
        m_lastError = 32 (0x00000020)

    rect = 
        left = 0 (0x00000000)
        top = 0 (0x00000000)
        right = 0 (0x00000000)
        bottom = 0 (0x00000000)

    swp_flags = 2 (0x00000002)

CVideoMode::SetVideoMode (videomode.cpp:150)
    this = (unavailable)
    w = 1024 (0x00000400)
    h = 768 (0x00000300)
    bpp = 32 (0x00000020)
    fullscreen = false

CVideoMode::SetFullscreen (videomode.cpp:414)
    this = (unavailable)
    fullscreen = false

psDisplayError (gamesetup.cpp:415)
    __formal = 0x0B690000 -> "Much to our regret we must report the program has encountered an error.

Please let us know at http://trac.wildfiregames.com/ and attach the crashlog.txt and crashlog.dmp files.

Details: unhandled exception (Access violation reading 0x10331100)

Location: unknown:0 (?)

Call stack:

(error while dumping stack: No stack frames found)
errno = 0 (No error reported here)
OS error = 0 (no error code was set)
"
    __formal = 0 (0x00000000)
    reentering = true 

debug_DisplayError (debug.cpp:469)
    description = 0x21A818C0 -> "Much to our regret we must report the program has encountered an error.

Please let us know at http://trac.wildfiregames.com/ and attach the crashlog.txt and crashlog.dmp files.

Details: unhandled exception (Access violation reading 0x10331100)
"
    flags = 0 (0x00000000)
    context = 0x0345EEE8
    lastFuncToSkip = 0x014504A4 -> "_wseh_ExceptionFilter"
    pathname = 0x0345EBF0 -> [8] { 0, 0, 0, 0, 0, 0, 0, 0 }
    line = 0 (0x00000000)
    func = 0x0143DF0C -> [8] { 63 ('?'), 0, 0, 0, 71 ('G'), 114 ('r'), 101 ('e'), 97 ('a') }
    suppress = 0x00000000
    emm = { pa_mem = 0x0B690000 (see above) }

wseh_ExceptionFilter (wseh.cpp:291)
    ep = (unavailable)
    func = [1000] 
        0
        0
        0
        0
        0
        0
        0
        0
        0
        0
        0
        0 ...
    message = "the program has encountered an error.

Please let us know at http://trac.wildfiregames.com/ and attach the crashlog.txt and crashlog.dmp files.

Details: unhandled exception (Access violation reading 0x10331100)
"
    descriptionBuf = "0"
    file = [100] 
        0
        0
        0
        0
        0
        0
        0
        0
        0
        0
        0
        0 ...
    nestingLevel = 1 (0x00000001)
    line = 1 (0x00000001)
    context = [2048] 
        2 (0x02)
        0 (0x00)
        0 (0x00)
        0 (0x00)
        72 (0x48)
        47 (0x2F)
        156 (0x9C)
        31 (0x1F)
        128 (0x80)
        185 (0xB9)
        69 (0x45)
        3 (0x03)
        44 (0x2C)
        185 (0xB9)
        69 (0x45)
        3 (0x03) ...

thread_start (wpthread.cpp:627)
    param = 0x00000000
    ret = 0x757E2450

seh_longjmp_unwind4 (:0)

endthreadex (:0)

endthreadex (:0)

RtlInitializeExceptionChain (:0)

RtlInitializeExceptionChain (:0)


errno = 13 (Insufficient access rights to open file)
OS error = 87 (The parameter is incorrect.)

Change History (2)

comment:1 by ben, 11 years ago

Owner: set to ben
Resolution: fixed
Status: newclosed

In 13808:

Fixes undefined behavior in Atlas error display, fixes #2115

comment:2 by historic_bruno, 11 years ago

Milestone: BacklogAlpha 15
Note: See TracTickets for help on using tickets.