[Development] QtCore: qt_addObject and qt_removeObject

Stephen Kelly stephen.kelly at kdab.com
Thu May 3 15:51:58 CEST 2012


On Thursday, May 03, 2012 15:07:47 Thiago Macieira wrote:
> 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 

We like the idea a lot, but it was already too late for Qt 5.0.

> 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.

Thanks,

-- 
Stephen Kelly <stephen.kelly at kdab.com> | Software Engineer
KDAB (Deutschland) GmbH & Co.KG, a KDAB Group Company
www.kdab.com || Germany +49-30-521325470 || Sweden (HQ) +46-563-540090
KDAB - Qt Experts - Platform-Independent Software Solutions
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/development/attachments/20120503/69ad6ca5/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.qt-project.org/pipermail/development/attachments/20120503/69ad6ca5/attachment.sig>


More information about the Development mailing list