Dynamic creation of IM Object using 'new' and 'delete'

Questions and postings pertaining to the development of ImageMagick, feature enhancements, and ImageMagick internals. ImageMagick source code and algorithms are discussed here. Usage questions which are too arcane for the normal user list should also be posted here.
Post Reply
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Post by magick »

Which version of ImageMagick are you using? ImageMagick is theoretically thread-safe. Can you post a program that is ideally less than 50 lines that illustrates the threading problem? We need to reproduce the problem before we can offer any advice.
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Post by magick »

If we comment out the call to new Image() and delete the program still fails suggesting a logic error somewhere else in the program. When we run the Magick++_Demos distributed with ImageMagick, they all run to completion without complaint. We're using ImageMagick 6.3.0-0.
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Post by magick »

This works for us. How 'bout you?

Code: Select all

#include <Magick++.h>
#include <iostream>
#include <string>
using namespace std;
using namespace Magick;
#include <wand/MagickWand.h>

int main(int argc, char** argv)
   {
     Image *pImg = new Image();
     delete pImg;
}
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Post by magick »

Our standard suggestion is to open the button workspace, typically in c:\Program Files\ImageMagick-6.3.0-Q16\Magick++_Demo, and build/run it. If it runs successfully, use the workspace as a model for your own custom workspace.
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Post by magick »

The IMDIsplay program that comes with the ImageMagick source distribution is a MFC project and the new operator worked fine for us.
Post Reply