Skip to content

Commit

Permalink
X11: Remove our X11 error callback in X11_DeleteDevice()
Browse files Browse the repository at this point in the history
If we don't remove it, we will infinitely recurse if X11_CreateDevice() is
called again and orig_x11_errhandler becomes X11_SafetyNetErrHandler().
  • Loading branch information
cgutman committed Sep 8, 2020
1 parent 9c342e7 commit 9a769da
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/video/x11/SDL_x11video.c
Expand Up @@ -92,6 +92,8 @@ get_classname()

/* X11 driver bootstrap functions */

static int (*orig_x11_errhandler) (Display *, XErrorEvent *) = NULL;

static void
X11_DeleteDevice(SDL_VideoDevice * device)
{
Expand All @@ -100,6 +102,7 @@ X11_DeleteDevice(SDL_VideoDevice * device)
device->Vulkan_UnloadLibrary(device);
}
if (data->display) {
X11_XSetErrorHandler(orig_x11_errhandler);
X11_XCloseDisplay(data->display);
}
SDL_free(data->windowlist);
Expand All @@ -111,7 +114,6 @@ X11_DeleteDevice(SDL_VideoDevice * device)

/* An error handler to reset the vidmode and then call the default handler. */
static SDL_bool safety_net_triggered = SDL_FALSE;
static int (*orig_x11_errhandler) (Display *, XErrorEvent *) = NULL;
static int
X11_SafetyNetErrHandler(Display * d, XErrorEvent * e)
{
Expand Down

0 comments on commit 9a769da

Please sign in to comment.