That occurred to me. The difference is that method is not logically equivilent to expressly placing the freeing functions since it creates additional pointers to the resources. Of course the compiler might be able to figure that out.
2009/5/28 Aaron J. Seigo <ase...@kde.org>: > On Thursday 28 May 2009, Casper Clemence wrote: >> hmmm... there must be a design pattern that achieves this elegantly >> with no extra overhead... maybe > > Pixmap bg = XCreatePixmap(display, clientWinId(), width(), height(), d- >>attr.depth); > XPixmapJanitor janitor(bg); > > > XPixmapJanitor would do the necessary clean up in its dtor. whenever the > method returns, janitor will fall out of scope, it's dtor will get run, the > pixap will be freed. > > common pattern. > > -- > Aaron J. Seigo > humru othro a kohnu se > GPG Fingerprint: 8B8B 2209 0C6F 7C47 B1EA EE75 D6B7 2EB1 A7F1 DB43 > > KDE core developer sponsored by Qt Software > > > _______________________________________________ > Plasma-devel mailing list > Plasma-devel@kde.org > https://mail.kde.org/mailman/listinfo/plasma-devel > > _______________________________________________ Plasma-devel mailing list Plasma-devel@kde.org https://mail.kde.org/mailman/listinfo/plasma-devel