On quarta-feira, 6 de junho de 2012 21.56.16, lars.kn...@nokia.com wrote:
> >https://codereview.qt-project.org/26981-Optimisedeletion
>
> I might be wrong (getting tired), but I think this reintroduces the
> problem with forward declared pointers that the first patch fixes.

It's a different solution.

The Qt 4 solution for this was to return false from a virtual function (the
default implementation), which would require the caller to perform the
deletion. The code was like this:

        if (!d->destroy())
                delete value;

This function was called from deref(), which meant that where a reference
could be dropped also required a full definition of the class.

The new optimisation does not introduce "delete value" into the reference-
dropping code path. That is still:

        d->destroy()
which does:
        void destroy() { destroyer(this); }
        (destroyer is a function pointer)

The optimisation simply changes what the pointed function does. Wiithout it,
it will call another stored function pointer. With it, it will call delete
directly.

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

Attachment: signature.asc
Description: This is a digitally signed message part.

_______________________________________________
Development mailing list
Development@qt-project.org
http://lists.qt-project.org/mailman/listinfo/development

Reply via email to