I'm very sorry, it seems I was wrong. Maybe when I tried that way that I described, I also inadvertently introduced a second mistake. It seems that I get a segfault inside my function when I do this:
const char* _cover
= QString::fromWCharArray(cover.
c_str()).
toStdString().
c_str();
const char* _cover = QString::fromWCharArray(cover.c_str()).toStdString().c_str();
image = QImage::fromData(QByteArray::fromBase64(QByteArray(_cover)));
To copy to clipboard, switch view to plain text mode
instead of:
image = QImage::fromData(QByteArray::fromBase64(QByteArray(QString::fromWCharArray(cover.c_str()).toStdString().c_str())));
To copy to clipboard, switch view to plain text mode
I excluded this as a possible mistake and confused it with a problem related to the way I was passing the parameter.
Any idea why those are different?
Thanks!
EDIT: I'm maybe misunderstanding the exact meaning of implicit sharing, or misusing it. I was referring to the fact that I'm using the operator= to copy references to image data, without copying just pointers. But maybe I'm wrong in this case, and implicit sharing is not involved.
Bookmarks