diff options
author | Thiago Macieira <thiago.macieira@intel.com> | 2013-02-24 09:14:20 -0800 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-02-26 22:01:27 +0100 |
commit | 1b76cf017427a98bf4487f3cf576611d82097539 (patch) | |
tree | f7348ce5e47854ea1e608a873b19b4c6889e5a41 /src/plugins/platforms/eglfs/qeglfshooks.h | |
parent | bc5170f274572a4b262569c12d5d3c6ef892aaf2 (diff) |
EGLFS: Replace the global static 'hooks' variable with a function
Having a global static variable in a header is a poor choice to start
with. All .cpp including that header must use that variable or the
compiler will warn of an unused static.
Second, for the case of platform hooks, it's possible that it is reading
the value of a variable that isn't initialised yet.
Change-Id: Id823c2be9cfededb9c31fb76a9080d4122577ca4
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
Reviewed-by: Gunnar Sletta <gunnar.sletta@digia.com>
Diffstat (limited to 'src/plugins/platforms/eglfs/qeglfshooks.h')
-rw-r--r-- | src/plugins/platforms/eglfs/qeglfshooks.h | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/src/plugins/platforms/eglfs/qeglfshooks.h b/src/plugins/platforms/eglfs/qeglfshooks.h index fc1ee16073..c4ac7185fb 100644 --- a/src/plugins/platforms/eglfs/qeglfshooks.h +++ b/src/plugins/platforms/eglfs/qeglfshooks.h @@ -72,15 +72,18 @@ public: virtual void waitForVSync() const; virtual const char *fbDeviceName() const; -}; + static QEglFSHooks *hooks() + { #ifdef EGLFS_PLATFORM_HOOKS -extern QEglFSHooks *platformHooks; -static QEglFSHooks *hooks = platformHooks; + extern QEglFSHooks *platformHooks; + return platformHooks; #else -extern QEglFSHooks stubHooks; -static QEglFSHooks *hooks = &stubHooks; + extern QEglFSHooks stubHooks; + return &stubHooks; #endif + } +}; QT_END_NAMESPACE |