diff --git a/client/src/main.c b/client/src/main.c index 80797897..8d27be79 100644 --- a/client/src/main.c +++ b/client/src/main.c @@ -734,7 +734,12 @@ static int lg_run(void) .minimizeOnFocusLoss = g_params.minimizeOnFocusLoss }; - g_state.ds->init(params); + g_state.dsInitialized = g_state.ds->init(params); + if (g_state.dsInitialized) + { + DEBUG_ERROR("Failed to initialize the displayserver backend"); + return -1; + } if (g_params.noScreensaver) g_state.ds->inhibitIdle(); @@ -972,7 +977,10 @@ static void lg_shutdown(void) } app_releaseAllKeybinds(); - g_state.ds->free(); + + if (g_state.dsInitialized) + g_state.ds->free(); + ivshmemClose(&g_state.shm); } diff --git a/client/src/main.h b/client/src/main.h index 54d3da39..1ad28e3c 100644 --- a/client/src/main.h +++ b/client/src/main.h @@ -43,6 +43,7 @@ struct AppState enum RunState state; struct LG_DisplayServerOps * ds; + bool dsInitialized; bool stopVideo; bool ignoreInput;