[Development] QtCore: qt_addObject and qt_removeObject

Adriano Rezende adriano.1.rezende at nokia.com
Thu May 3 14:53:44 CEST 2012


Currently we have these 2 functions in qobject.cpp:

extern "C" Q_CORE_EXPORT void qt_addObject(QObject *)

extern "C" Q_CORE_EXPORT void qt_removeObject(QObject *)

The qt_addObject is being called in the QObject constructor and 
qt_removeObject in the destructor.
It seems that they are being overloaded via ld_preload by some profiling 
tools like Squish to do some tracing. I'm also using them to trace 
QObjects lifetime in QML applications.

I think this kind of tracing is interesting to have in QtCreator and 
also in some other external tools. The problem is that this approach is 
not multiplatform and we don't have any guarantee that these functions 
will not be removed by accident.

My suggestion is to replace them by callbacks and keep the setters in a 
private header. Someone is against this idea?


More information about the Development mailing list