QtGlobal: remove qIsDetached()

There's not a single in-tree user of this function, and
the concept is a broken one in MT programs: By the time
qIsDetached() returns, the result can already be
different due to another thread taking a copy, or a
copy in another thread being destroyed (note that this
doesn't require mutex use by the user, since we promise
(implicitly, if not explicitly) that you can copy from
const objects without holding a lock).

QTBUG-10813 talks about a use in QCache::trim(), but
677cf76340 removed it, so
there's no reason to keep it anymore.

Change-Id: I20380c12bdf00ac764b89d84392f0f34727b1971
Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
bb10
Marc Mutz 2012-02-24 22:27:32 +01:00 committed by Qt by Nokia
parent d3eb877951
commit a1c75534a4
3 changed files with 2 additions and 6 deletions

2
dist/changes-5.0.0 vendored
View File

@ -45,6 +45,8 @@ information about a particular change.
in Qt4, so these methods return a bool now. If your code used the undocumented
QBool, simply replace it with bool.
- qIsDetached<> has been removed without replacement.
- QMetaType:
* QMetaType::construct() has been renamed to QMetaType::create().
* QMetaType::unregisterType() has been removed.

View File

@ -49,15 +49,12 @@ QT_BEGIN_NAMESPACE
/*
QTypeInfo - type trait functionality
qIsDetached - data sharing functionality
*/
/*
The catch-all template.
*/
template <typename T> inline bool qIsDetached(T &) { return true; }
template <typename T>
class QTypeInfo
{
@ -188,7 +185,6 @@ QT_BEGIN_NAMESPACE
#endif
#define Q_DECLARE_SHARED(TYPE) \
template <> inline bool qIsDetached<TYPE>(TYPE &t) { return t.isDetached(); } \
template <> inline void qSwap<TYPE>(TYPE &value1, TYPE &value2) \
{ qSwap(value1.data_ptr(), value2.data_ptr()); } \
Q_DECLARE_SHARED_STL(TYPE)

View File

@ -96,8 +96,6 @@ public:
QPixmapCache::Key key;
};
inline bool qIsDetached(QPixmapCacheEntry &t) { return t.isDetached(); }
QT_END_NAMESPACE
#endif // QPIXMAPCACHE_P_H