And properly added init and thread checks to the uiEvent functions. Now we just need to do the same on the other platforms and THEN FINALLY we can move on to controls.

This commit is contained in:
Pietro Gagliardi 2019-05-29 00:41:36 -04:00
parent a632d10701
commit fd770430a9
2 changed files with 13 additions and 0 deletions

View File

@ -36,6 +36,8 @@ uiEvent *uiNewEvent(const uiEventOptions *options)
{
uiEvent *e;
if (!uiprivCheckInitializedAndThread())
return NULL;
if (options == NULL) {
uiprivProgrammerError(uiprivProgrammerErrorNullPointer, "uiEventOptions", uiprivFunc);
return NULL;
@ -78,6 +80,8 @@ int uiEventAddHandler(uiEvent *e, uiEventHandler handler, void *sender, void *da
struct handler *h;
int id;
if (!uiprivCheckInitializedAndThread())
return 0;
checkEventNonnull(e, 0);
checkEventNotFiring(e, 0);
if (handler == NULL) {
@ -123,6 +127,8 @@ void uiEventDeleteHandler(uiEvent *e, int id)
{
struct handler *h;
if (!uiprivCheckInitializedAndThread())
return;
checkEventNonnull(e, /* nothing */);
checkEventNotFiring(e, /* nothing */);
h = findHandler(e, id, uiprivFunc);
@ -138,6 +144,8 @@ void uiEventFire(uiEvent *e, void *sender, void *args)
struct handler *h;
size_t i;
if (!uiprivCheckInitializedAndThread())
return;
checkEventNonnull(e, /* nothing */);
if (e->firing) {
uiprivProgrammerError(uiprivProgrammerErrorRecursiveEventFire);
@ -160,6 +168,8 @@ bool uiEventHandlerBlocked(const uiEvent *e, int id)
{
struct handler *h;
if (!uiprivCheckInitializedAndThread())
return false;
checkEventNonnull(e, false);
h = findHandler(e, id, uiprivFunc);
if (h == NULL)
@ -171,6 +181,8 @@ void uiEventSetHandlerBlocked(uiEvent *e, int id, bool blocked)
{
struct handler *h;
if (!uiprivCheckInitializedAndThread())
return;
checkEventNonnull(e, /* nothing */);
checkEventNotFiring(e, /* nothing */);
h = findHandler(e, id, uiprivFunc);

View File

@ -1,6 +1,7 @@
// 28 may 2019
// This file should NOT have include guards as it is intended to be included more than once; see noinitwrongthread.c for details.
// TODO pass in file and line properly
allcallsCase(uiMain, /* no arguments */)
allcallsCase(uiQuit, /* no arguments */)