[Interest] loading PPM {poof}

Waitman Gobble uzimac at da3m0n8t3r.com
Thu Jun 21 08:45:39 CEST 2012


Thiago Macieira <thiago.macieira at intel.com> wrote ..
> On quarta-feira, 20 de junho de 2012 21.32.17, Waitman Gobble wrote:
> >             path = model->filePath(index);
> >             qDebug() << path;
> >
> >         QPixmap pm(path);
> >         statusBar()->showMessage(
> >         tr("puf (%1) ")
> >             .arg(pm.width()+","+pm.height()));
> >
> >         gs->clear();
> >         gs->addPixmap(pm);
> >         gs->setSceneRect(pm.rect());
> >         gv->setScene(gs);
> >         gv->update();
> >
> > message:
> > "/home/waitman/pv2012/2012-06-15/marina/DCIM/100CANON/ppm/IMG_6651.ppm"
> > ""
> > The program has unexpectedly finished.
>
> The fact that we see the first debug indicates that the second line of your
> code ran fine. But there's another "" debug and I don't see a matching
> qDebug().
>
> Which line, exactly, did your program crash in? Please get the values of all
> pointers used in that line and tell us how sure (100%, less than 100%) that
> they were properly initialised.
>
> --
> 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

Thanks for your reply.

Sorry about that extra "", was left over from my file type check. There is probably a better way to do it but this was the first thing I thought of:

if (path!="") {

        QStringList arguments;
        QString foo = "/usr/bin/file "+path+" | grep JPEG";
        arguments << "-c" << foo;
        QProcess* process = new QProcess(this);
        process->start("/bin/sh", arguments);
        process->waitForFinished();

        QString tmp = process->readAll();
        qDebug() << "results:" << tmp;
        if (tmp.lastIndexOf("JPEG")>0) {


I added "results:" to make sure that was actually spitting out the ""

example:
path: "/home/waitman/pv2012/2012-06-15/marina/DCIM/100CANON/jpeg-out/IMG_5643.ppm.jpg" 
results: "/home/waitman/pv2012/2012-06-15/marina/DCIM/100CANON/jpeg-out/IMG_5643.ppm.jpg: JPEG image data, JFIF standard 1.01
" 
path: "/home/waitman/pv2012/2012-06-15/marina/DCIM/100CANON/ppm/IMG_5877.ppm" 
results: "" 
The program has unexpectedly finished.
/usr/home/waitman/puf/puf exited with code 0


When I switch to lastIndexOf("JPEG")<0 ... (not a JPEG) and load a PPM it halts.





** What's strange to me is it mysteriously worked one time just a few minutes ago....


path: "/home/waitman/pv2012/2012-06-15/marina/DCIM/100CANON/ppm/IMG_5639.ppm" 
results: "" 
 gv w  475 
 gs w  5202 
 gv h  331 
 gs h  3465 
path: "/home/waitman/pv2012/2012-06-15/marina/DCIM/100CANON/ppm/IMG_5844.ppm" 
results: "" 
 gv w  475 
 gs w  5202 
 gv h  331 
 gs h  3465 
path: "/home/waitman/pv2012/2012-06-15/marina/DCIM/100CANON/ppm/IMG_5866.ppm" 
results: "" 
 gv w  475 
 gs w  5202 
 gv h  331 
 gs h  3465 
path: "/home/waitman/pv2012/2012-06-15/marina/DCIM/100CANON/ppm/IMG_5890.ppm" 
results: "" 
 gv w  475 
 gs w  5202 
 gv h  331 
 gs h  3465 

.. etc

no problems

but when i restart, it crashes again. restarting multiple times, cleaning and rebuild it's still halting. i checked the images that were loading, it still halts.

(note the first click is on the directory path, does not cause stop)

Starting /usr/home/waitman/puf/puf...
path: "/home/waitman/pv2012/2012-06-15/marina/DCIM/100CANON/ppm" 
results: "" 
 gv w  364 
 gs w  0 
 gv h  331 
 gs h  0 
path: "/home/waitman/pv2012/2012-06-15/marina/DCIM/100CANON/ppm/IMG_5696.ppm" 
results: "" 
The program has unexpectedly finished.
/usr/home/waitman/puf/puf exited with code 0




moving my qDebug() << "here" line around i found that it stops here:


            statusBar()->showMessage(
            tr("puf (%1) ")
                .arg(pm.width()+","+pm.height()));


maybe that's not correct, checking it out. it seems to work with JPEG without any issues, and i did actually see it run one time (randomly).

Thanks,


-- 
Waitman Gobble
San Jose California USA



More information about the Interest mailing list