diff options
author | inmarket <andrewh@inmarket.com.au> | 2014-02-03 18:00:46 +1000 |
---|---|---|
committer | inmarket <andrewh@inmarket.com.au> | 2014-02-03 18:00:46 +1000 |
commit | 0805033a660bf45751c78f1d715b7765d9aa2642 (patch) | |
tree | afe114b96a20bf8397941a2689b7490101a55537 | |
parent | de7aafe785e5641115aa4b3f5a900515d8d36a28 (diff) | |
download | uGFX-0805033a660bf45751c78f1d715b7765d9aa2642.tar.gz uGFX-0805033a660bf45751c78f1d715b7765d9aa2642.tar.bz2 uGFX-0805033a660bf45751c78f1d715b7765d9aa2642.zip |
Ensure double initialisation/de-initialisation of GFX can't occur
-rw-r--r-- | src/gfx.c | 12 |
1 files changed, 11 insertions, 1 deletions
@@ -15,6 +15,8 @@ #include "gfx.h" +static bool_t initDone = FALSE; + /* These init functions are defined by each module but not published */ extern void _gosInit(void); extern void _gosDeinit(void); @@ -57,6 +59,11 @@ extern void _gosDeinit(void); void gfxInit(void) { + /* Ensure we only initialise once */ + if (initDone) + return; + initDone = TRUE; + // These must be initialised in the order of their dependancies _gosInit(); @@ -91,8 +98,11 @@ void gfxInit(void) void gfxDeinit(void) { - // We deinitialise the opposit way as we initialised + if (!initDone) + return; + initDone = FALSE; + // We deinitialise the opposite way as we initialised #if GFX_USE_GAUDOUT _gaudoutDeinit(); #endif |