[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    KDE/kdelibs/phonon
From:       Matthias Kretz <kretz () kde ! org>
Date:       2008-03-29 21:37:03
Message-ID: 1206826623.889629.22612.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 791565 by mkretz:

add an assertion to operator-> as it always needs to return a non-null pointer

 M  +3 -3      phonondefs_p.h  


--- trunk/KDE/kdelibs/phonon/phonondefs_p.h #791564:791565
@@ -271,8 +271,8 @@
         inline Iface(MediaNodePrivate *const d) : iface(cast(d)) {}
         inline operator       T0 *()       { return iface; }
         inline operator const T0 *() const { return iface; }
-        inline       T0 *operator->()       { return iface; }
-        inline const T0 *operator->() const { return iface; }
+        inline       T0 *operator->()       { Q_ASSERT(iface); return iface; }
+        inline const T0 *operator->() const { Q_ASSERT(iface); return iface; }
     private:
         T0 *const iface;
     };
@@ -283,7 +283,7 @@
     public:
         inline ConstIface(const MediaNodePrivate *const d) : iface(Iface<T0, T1, T2>::cast(d)) {}
         inline operator const T0 *() const { return iface; }
-        inline const T0 *operator->() const { return iface; }
+        inline const T0 *operator->() const { Q_ASSERT(iface); return iface; }
     private:
         const T0 *const iface;
     };
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic