Friday 15 May 2015

c++ - Magick++ segfaults in thread -


Write a scanning program After reading an image, call this convertToPDF () and then the next The image reads program seg defect ( running is finished; segmentation error: 11; ) when the image is declared in the thread. The only code works fine when running in the main thread; I was taken from thrPDF to convertToPDF to ensure that I'm thinking that Magic ++ It is something to do with memory allocation that is on my head. Any help will be very much appreciated.

  Zero Scan Window :: ConvertTOPDF (String Filename) {Convert Pthread_t; String * args = new string (fileName); Zero * thrPDF (Zero *); Pthread_create (& convert, zero, thrPDF, args); } Zero * thrPDF (Zero * A) {string * fName = (string *) A; String newfile = fName-> Substr (0, fName-> height () - 3) + "pdf"; Magic :: Image img (* f annaam); // This line is that img.magick ("pdf") fault fault; Img.write (newFile); Pthread_exit (0); }   

Here is the call stack:
omp_get_max_threads (?)
GetOpenMPMaximumThreads inlined
AcquirePixelCache (?)
Receive (?)
Magick :: ImageRef :: ImageRef (?)
Magick :: Image :: Image (?)
thrPDF (?)
_pthread_start (?)
thread_start (?) < P>

If it has not already been done, you should initializeMagick (NULL) (or InitializeMagick (* argv)) in your main / original thread. To start using the rest of the API in the past, it can help to fix some issues related to threading. Magical ++ is included with graphics magic, this is a complete requirement in modern releases.

No comments:

Post a Comment