uchar* QImage::bits() returned '\0'...(nullptr)
-
@shtomik
Hi
ok so localImage is valid ?
Normally its due to invalid image it returns null.
But if in Format_RGB32 it should work.
localImage bits() also returns null ? -
@mrjj
Yes, is valid, I can save pic and not null... All is good, but what's wrong?(Now I'm using:
QImage *img = new QImage(ui->oGLArea->grabFramebuffer());without localImage...
So
After copying QImage to QImage, bits() fail ?
QImage::QImage(const QImage &image)
makes a shallow copy so i wonder if something goes out of scope ?
If you do
QImage img = ui->oGLArea->grabFramebuffer();
is bits() still NULL ?
Im wondering of the implicit sharing is doing something. -
So
After copying QImage to QImage, bits() fail ?
QImage::QImage(const QImage &image)
makes a shallow copy so i wonder if something goes out of scope ?
If you do
QImage img = ui->oGLArea->grabFramebuffer();
is bits() still NULL ?
Im wondering of the implicit sharing is doing something. -
@mrjj
I'm trying QImage::copy() too, but it's fail...If you do
QImage img = ui->oGLArea->grabFramebuffer();
is bits() still NULL ?Yes.
-
@shtomik
Hmm. that is really odd if u can save them as working files.
Im out of guesses.
Give it some hours , others will come online and might have a good idea. -
Are you sure its null ? By that I mean, what happens if you test
if ( bits == nullptr ) { } else { qDebug () << *bits << *(bits + 1) << *(bits + 2) }I ask because your description of whats shown in the debuggers sounds like the
debugger is looking at the first part of the pixel, which could be 0. -
what does
qDebug() << QByteArray(reinterpret_cast<const char*>(img->constBits()),img->bytesPerLine()).size();print out (if it doesn't crash)? -
Are you sure its null ? By that I mean, what happens if you test
if ( bits == nullptr ) { } else { qDebug () << *bits << *(bits + 1) << *(bits + 2) }I ask because your description of whats shown in the debuggers sounds like the
debugger is looking at the first part of the pixel, which could be 0.@mranger90
You are right! If first pixel not BLACK, debuger shows buffer of bits, but if first char - 0, empty buffer... -
Are you sure its null ? By that I mean, what happens if you test
if ( bits == nullptr ) { } else { qDebug () << *bits << *(bits + 1) << *(bits + 2) }I ask because your description of whats shown in the debuggers sounds like the
debugger is looking at the first part of the pixel, which could be 0.