[client] ds: validate the ds before attempting to use it

This commit is contained in:
Geoffrey McRae 2021-01-27 10:41:11 +11:00
parent f8ac860fde
commit 2d1e3c8022
2 changed files with 23 additions and 0 deletions

View File

@ -141,4 +141,26 @@ struct LG_DisplayServerOps
void (*cbRequest)(LG_ClipboardData type);
};
#define IS_LG_DS_VALID(x) \
((x)->probe && \
(x)->earlyInit && \
(x)->init && \
(x)->startup && \
(x)->shutdown && \
(x)->free && \
(x)->getProp && \
(x)->getEGLDisplay && \
(x)->getEGLNativeWindow && \
(x)->glSwapBuffers && \
(x)->showPointer && \
(x)->grabPointer && \
(x)->ungrabPointer && \
(x)->warpPointer && \
(x)->realignPointer && \
(x)->isValidPointerPos && \
(x)->inhibitIdle && \
(x)->uninhibitIdle && \
(x)->wait && \
(x)->setWindowSize && \
(x)->setFullscreen)
#endif

View File

@ -633,6 +633,7 @@ static int lg_run(void)
}
assert(g_state.ds);
assert(IS_LG_DS_VALID(g_state.ds));
// init the subsystem
if (!g_state.ds->earlyInit())