Skip to content

Commit b54c5fd

Browse files
committed
x11: Check for a valid input context before destroying it
XDestroyIC crashes if passed a null parameter.
1 parent 8a5f9a3 commit b54c5fd

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/video/x11/SDL_x11keyboard.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -770,7 +770,10 @@ void X11_CreateInputContext(SDL_WindowData *data)
770770
void X11_DestroyInputContext(SDL_WindowData *data)
771771
{
772772
#ifdef X_HAVE_UTF8_STRING
773-
X11_XDestroyIC(data->ic);
773+
if (data->ic) {
774+
X11_XDestroyIC(data->ic);
775+
data->ic = NULL;
776+
}
774777
SDL_free(data->preedit_text);
775778
SDL_free(data->preedit_feedback);
776779
data->preedit_text = NULL;

0 commit comments

Comments
 (0)