[client] app: don't call ds->free if the ds was not initialized

This commit is contained in:
Geoffrey McRae 2021-01-27 19:27:19 +11:00
parent 8919d2718f
commit 7d2c9ec447
2 changed files with 11 additions and 2 deletions

View File

@ -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);
}

View File

@ -43,6 +43,7 @@ struct AppState
enum RunState state;
struct LG_DisplayServerOps * ds;
bool dsInitialized;
bool stopVideo;
bool ignoreInput;