Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. QImage crash when saving image(Qt5.0.2) on mac osx 10.8.3
Qt 6.11 is out! See what's new in the release blog

QImage crash when saving image(Qt5.0.2) on mac osx 10.8.3

Scheduled Pinned Locked Moved General and Desktop
1 Posts 1 Posters 1.6k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • ? Offline
    ? Offline
    A Former User
    wrote on last edited by
    #1

    Codes

    @#include <functional>

    #include <QApplication>
    #include <QtConcurrent/QtConcurrentMap>
    #include <QImage>
    #include <QLabel>

    //QMutex mutex;

    int process_image_impl(QString const &name)
    {
    QImage image(name);

    if(!image.isNull()){                
         //QMutexLocker(&QMutex);  you have to lock it to prevent undefined behavior
         image.save("save/" + name);       
    }
    
    return 0;
    

    }

    int main(int argc, char *argv[])
    {
    QApplication a(argc, argv);

    namespace ph = std::placeholders;
    
    QStringList image_name;
    for(size_t i = 0; i != 10; ++i){
        image_name <<("onebit_" + QString::number(30 + i) + ".png");
    }
    QtConcurrent::blockingMapped(image_name, std::bind<int>(process_image_impl, ph::_1));
    
    QLabel w;
    w.show();
    
    return a.exec(&#41;;
    

    }@

    Sometimes this would crash(race condition?) if you don't lock the save function
    Is this a bug? Or a behavior of save?In Qt4 I haven't found this kind of problem yet

    Sorry, I don't know how to trace the bugs by callstack on mac yet
    It wouldn't generate the callstack trace like this page show

    "callstack":http://doc.qt.digia.com/qtcreator/creator-debug-mode.html

    These are part of the error messages after the .app crash
    Anyone know how to decipher the messages?
    Could I find out the program crash on which line by the messages?
    Or I have an easier way to map the address to source codes?

    "error messages":http://www.flickr.com/photos/92283971@N04/8678167798/in/photostream

    Should I treat this as a bug and report?

    ps : there are the other small bug, the SLOT aboutQt will always show you you are using Qt5.0.1 but not Qt5.0.2

    1 Reply Last reply
    0

    • Login

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Get Qt Extensions
    • Unsolved