Reputation: 9811
I am writing a Qt application that has to handle big QImage s. QImage uses implicit sharing, which means it reference counts an internal data pointer. Whenever the refcount is > 1 the object counts as "shared" and any even only potentially data modifying call issues a deep copy of the image data.
In short: I don't want deep copies to happen.
I make a number of calls like setPixel(), bits() etc. that can trigger a copy. The documentation sometimes reads as if certain calls would always trigger a deep copy (detach call) even if I try my hardest to keep the refcount at 1. Like here: QImage::setPixel()
So I want to know:
Upvotes: 2
Views: 2036
Reputation: 7787
return d && d->ref == 1;
. By using a debugger, you can get to the actual refcount.Upvotes: 1