Re: GraphicsMagick may collapse when binding into a server

Bob Friesenhahn <[email protected]> Fri, 17 May 2013 09:12:29 -0500 (CDT)
Newsgroups gmane.comp.video.graphicsmagick.bugs
Message-ID <[email protected]>
On Fri, 17 May 2013, Feng Liyuan wrote:

> I bind these code into a golang server to deal with images.
>
>       #cgo pkg-config: GraphicsMagick
>
>       #include <magick/api.h>
>
>       static int GMCmd(int argc, char **argv) {
>           int status;
>           status = GMCommand(argc, argv);
>           return status;
>       }
> 
> 
> It may collapse and let server panic.

I am not sure how a server might panic.  At any rate, the solution is 
simple.

Add

   InitializeMagick(*argv);

after the

   int status;

And all should be well.  In fact it should be better since after 
invoking InitializeMagick() once, all of GM's internal semaphores are 
fully initialized and so you can safely invoke GMCommand() in a 
threaded context without fear of any race condition.

Bob
-- 
Bob Friesenhahn
[email protected], http://www.simplesystems.org/users/bfriesen/
GraphicsMagick Maintainer,    http://www.GraphicsMagick.org/

------------------------------------------------------------------------------
AlienVault Unified Security Management (USM) platform delivers complete
security visibility with the essential security capabilities. Easily and
efficiently configure, manage, and operate all of your security controls
from a single console and one unified framework. Download a free trial.
http://p.sf.net/sfu/alienvault_d2d

_______________________________________________
Graphicsmagick-bugs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/graphicsmagick-bugs