Ticket #2847: fix-atlas-sdl2.v2.diff

File fix-atlas-sdl2.v2.diff, 2.7 KB (added by historic_bruno, 9 years ago)

updated patch to fix crash on Windows

  • source/tools/atlas/AtlasUI/ScenarioEditor/ScenarioEditor.cpp

     
    521521    // Need to make sure the canvas is realised, so that its context is valid
    522522    // this solves the "invalid drawable" error
    523523    Show(true);
     524    Raise();
    524525#endif
    525526#ifdef __WXGTK__
    526527    // TODO: wxSafeYield causes issues on wxOSX 2.9, is it necessary?
     
    529530
    530531    // Send setup messages to game engine:
    531532
     533#ifdef __WXGTK__
     534    // On Linux we need to initialize SDL graphics system here, or it breaks SDL2
     535    // but this apparently breaks some drivers on Windows
     536    POST_MESSAGE(InitSDL, ());
     537#endif
     538
    532539    POST_MESSAGE(SetCanvas, (static_cast<wxGLCanvas*>(canvas),
    533540        canvas->GetClientSize().GetWidth(), canvas->GetClientSize().GetHeight()));
    534541
     542#ifndef __WXGTK__
     543    // Initialize SDL graphics system here if not on Linux
     544    POST_MESSAGE(InitSDL, ());
     545#endif
     546
    535547    POST_MESSAGE(InitGraphics, ());
    536548
    537549    canvas->InitSize();
  • source/tools/atlas/GameInterface/Handlers/GraphicsSetupHandlers.cpp

     
    1 /* Copyright (C) 2014 Wildfire Games.
     1/* Copyright (C) 2015 Wildfire Games.
    22 * This file is part of 0 A.D.
    33 *
    44 * 0 A.D. is free software: you can redistribute it and/or modify
     
    6262    g_VideoMode.InitNonSDL();
    6363}
    6464
    65 MESSAGEHANDLER(InitGraphics)
     65MESSAGEHANDLER(InitSDL)
    6666{
    6767    UNUSED2(msg);
    6868
     
    8181    SDL_GL_LoadLibrary(NULL); // NULL = use default
    8282    // (it shouldn't hurt if this is called multiple times, I think)
    8383#endif
     84}
    8485
     86MESSAGEHANDLER(InitGraphics)
     87{
     88    UNUSED2(msg);
     89
    8590    ogl_Init();
    8691
    8792    InitGraphics(g_AtlasGameLoop->args, g_InitFlags);
  • source/tools/atlas/GameInterface/Messages.h

     
    3232// Initialise some engine code. Must be called before anything else.
    3333MESSAGE(Init, );
    3434
     35// Initialise SDL-related code. Must be called before SetCanvas and InitGraphics.
     36MESSAGE(InitSDL, );
     37
    3538// Initialise graphics-related code. Must be called after the first SetCanvas,
    3639// and before much else.
    3740MESSAGE(InitGraphics, );
    38 
    3941// Shut down engine/graphics code.
    4042MESSAGE(Shutdown, );
    4143