ImGui: avoid non-reentrant call to VideoPresentScreen().
The debugger (which calls VideoPresentScreen) is execute in immediate mode from VideoPresentScreen. Is this a design problem? Signed-off-by: Andrea Odetti <mariofutire@gmail.com>
This commit is contained in:
parent
2abca0c0b2
commit
c70377fcaf
2 changed files with 19 additions and 10 deletions
|
@ -36,6 +36,7 @@ namespace sa2
|
|||
|
||||
SDLImGuiFrame::SDLImGuiFrame(const common2::EmulatorOptions & options)
|
||||
: SDLFrame(options)
|
||||
, myPresenting(false)
|
||||
{
|
||||
SDL_GL_SetAttribute(SDL_GL_CONTEXT_FLAGS, SA2_CONTEXT_FLAGS);
|
||||
SDL_GL_SetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, SA2_CONTEXT_PROFILE_MASK);
|
||||
|
@ -187,18 +188,25 @@ namespace sa2
|
|||
|
||||
void SDLImGuiFrame::VideoPresentScreen()
|
||||
{
|
||||
ImGui_ImplOpenGL3_NewFrame();
|
||||
ImGui_ImplSDL2_NewFrame(myWindow.get());
|
||||
ImGui::NewFrame();
|
||||
// this is NOT REENTRANT
|
||||
// the debugger (executed via mySettings.show(this)) might call it recursively
|
||||
if (!myPresenting)
|
||||
{
|
||||
myPresenting = true;
|
||||
ImGui_ImplOpenGL3_NewFrame();
|
||||
ImGui_ImplSDL2_NewFrame();
|
||||
ImGui::NewFrame();
|
||||
|
||||
// "this" is a bit circular
|
||||
mySettings.show(this);
|
||||
DrawAppleVideo();
|
||||
// "this" is a bit circular
|
||||
mySettings.show(this);
|
||||
DrawAppleVideo();
|
||||
|
||||
ImGui::Render();
|
||||
ClearBackground();
|
||||
ImGui_ImplOpenGL3_RenderDrawData(ImGui::GetDrawData());
|
||||
SDL_GL_SwapWindow(myWindow.get());
|
||||
ImGui::Render();
|
||||
ClearBackground();
|
||||
ImGui_ImplOpenGL3_RenderDrawData(ImGui::GetDrawData());
|
||||
SDL_GL_SwapWindow(myWindow.get());
|
||||
myPresenting = false;
|
||||
}
|
||||
}
|
||||
|
||||
void SDLImGuiFrame::ProcessSingleEvent(const SDL_Event & event, bool & quit)
|
||||
|
|
|
@ -41,6 +41,7 @@ namespace sa2
|
|||
size_t myBorderlessHeight;
|
||||
|
||||
int myDeadTopZone; // for mouse position
|
||||
bool myPresenting; // VideoPresentScreen() is NOT REENTRANT
|
||||
|
||||
SDL_GLContext myGLContext;
|
||||
ImTextureID myTexture;
|
||||
|
|
Loading…
Add table
Reference in a new issue