summaryrefslogtreecommitdiffstats
path: root/src/corelib/kernel/qobject_impl.h
diff options
context:
space:
mode:
authorMarc Mutz <marc.mutz@kdab.com>2012-08-17 16:13:19 +0200
committerQt by Nokia <qt-info@nokia.com>2012-08-26 14:34:06 +0200
commit2d78e241918453a978f46a6246234cff881e9174 (patch)
tree95686c2a685f1bdb7140780219b5c3c708e91b19 /src/corelib/kernel/qobject_impl.h
parent4570d0ac2401f3902cff1bd72cac78f599103096 (diff)
QSlotObjectBase: make Operation enum protected
We don't want people to go and call through the function pointer directly. Change-Id: I386645239974f008d513eaa62593c1141b294b60 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
Diffstat (limited to 'src/corelib/kernel/qobject_impl.h')
-rw-r--r--src/corelib/kernel/qobject_impl.h8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/corelib/kernel/qobject_impl.h b/src/corelib/kernel/qobject_impl.h
index 3586b1c7f7..9eda421f0e 100644
--- a/src/corelib/kernel/qobject_impl.h
+++ b/src/corelib/kernel/qobject_impl.h
@@ -106,6 +106,9 @@ namespace QtPrivate {
// don't use virtual functions here; we don't want the
// compiler to create tons of per-polymorphic-class stuff that
// we'll never need. We just use one function pointer.
+ typedef void (*ImplFn)(int which, QSlotObjectBase* this_, QObject *receiver, void **args, bool *ret);
+ const ImplFn impl;
+ protected:
enum Operation {
Destroy,
Call,
@@ -113,10 +116,9 @@ namespace QtPrivate {
NumOperations
};
- typedef void (*ImplFn)(int which, QSlotObjectBase* this_, QObject *receiver, void **args, bool *ret);
- const ImplFn impl;
-
+ public:
explicit QSlotObjectBase(ImplFn fn) : ref(1), impl(fn) {}
+
inline void destroy() { impl(Destroy, this, 0, 0, 0); }
inline bool compare(void **a) { bool ret; impl(Compare, this, 0, a, &ret); return ret; }
inline void call(QObject *r, void **a) { impl(Call, this, r, a, 0); }