• Show log

    Commit

  • Hash : ce8aae14
    Author : Dean Herbert
    Date : 2022-07-13T15:01:55

    Fix `Cocoa_GetWindowDisplayIndex` failing and causing a catastrophic crash
    
    With the introduction of this function, it is possible that for certain
    monitor and window configurations, creating an SDL window will cause a
    native crash.
    
    ```
    Crashed Thread:        0  Dispatch queue: com.apple.main-thread
    
    Exception Type:        EXC_BAD_ACCESS (SIGSEGV)
    Exception Codes:       KERN_INVALID_ADDRESS at 0x0000000000000050
    Exception Codes:       0x0000000000000001, 0x0000000000000050
    Exception Note:        EXC_CORPSE_NOTIFY
    
    Termination Reason:    Namespace SIGNAL, Code 11 Segmentation fault: 11
    Terminating Process:   exc handler [56627]
    
    VM Region Info: 0x50 is not in any region.  Bytes before following region: 140737486737328
          REGION TYPE                    START - END         [ VSIZE] PRT/MAX SHRMOD  REGION DETAIL
          UNUSED SPACE AT START
    --->
          VM_ALLOCATE              7fffffe75000-7fffffe76000 [    4K] r-x/r-x SM=ALI
    
    Thread 0 Crashed::  Dispatch queue: com.apple.main-thread
    0   libSDL2.dylib                            0x10247f665 SDL_UpdateFullscreenMode + 357
    1   libSDL2.dylib                            0x10247ec70 SDL_CreateWindow_REAL + 1504
    2   ???                                      0x111262de8 ???
    3   ???                                      0x110c39fff ???
    4   libcoreclr.dylib                         0x101fdf2a9 CallDescrWorkerInternal + 124
    ```
    
    Tracking thread from our end: https://github.com/ppy/osu-framework/issues/5190
    Regressed with: https://github.com/libsdl-org/SDL/pull/5573
    
    In testing, the window would not find a valid screen if created
    "hanging" off a primary display with a secondary display below it. In
    checking why this was the case, the `display_centre` was being
    calculated with a negative y origin, causing a final negative value
    falling outside all display bounds:
    
    ```
    SDL error log [debug]: display_centre.y = -1296 + 1296 / 2
    
    SDL error log [debug]: Display rect 0: 0 0 2560 1440
    SDL error log [debug]: Display rect 1: 2560 -625 1080 2560
    SDL error log [debug]: Display rect 2: 0 1440 1728 1296
    ```
    
    The method that was being used to find the current window using the frame
    origin/size seems unreliable, so I have opted to replace it with with a
    tried method (https://stackoverflow.com/a/40891902).
    
    Initial testing shows that this works with non-standard DPI screens, but
    further testing would be appreciated (cc @sezero / @misl6 from the
    original PR thread).
    

  • Properties

  • Git HTTP https://git.kmx.io/kc3-lang/SDL.git
    Git SSH git@git.kmx.io:kc3-lang/SDL.git
    Public access ? public
    Description

    Fork of https://github.com/libsdl-org/SDL

    Users
    kc3_lang_org thodg_w www_kmx_io thodg_l thodg thodg_m
    Tags

  • README.md

  • Simple DirectMedia Layer (SDL) Version 2.0

    https://www.libsdl.org/

    Simple DirectMedia Layer is a cross-platform development library designed to provide low level access to audio, keyboard, mouse, joystick, and graphics hardware via OpenGL and Direct3D. It is used by video playback software, emulators, and popular games including Valve’s award winning catalog and many Humble Bundle games.

    More extensive documentation is available in the docs directory, starting with README.md

    Enjoy!

    Sam Lantinga (slouken@libsdl.org)