[Development] QtCore: qt_addObject and qt_removeObject

Thiago Macieira thiago.macieira at intel.com
Thu May 3 15:07:47 CEST 2012

On quinta-feira, 3 de maio de 2012 14.53.44, Adriano Rezende wrote:
> Hi,
> 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.

They won't be removed by accident because, at least for those, we know exactly 
what they are.

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

Not at all.

I suggested that the Squish and Gamma Ray developers get together and put 
together a proper callback implementation set, which we'll gladly use in Qt 5. 
I don't think that is high in their priority list, though.

Thiago Macieira - thiago.macieira (AT) intel.com
  Software Architect - Intel Open Source Technology Center
     Intel Sweden AB - Registration Number: 556189-6027
     Knarrarnäsgatan 15, 164 40 Kista, Stockholm, Sweden
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 190 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.qt-project.org/pipermail/development/attachments/20120503/91b9b8e2/attachment.sig>

More information about the Development mailing list