Skip to content

Commit

Permalink
Make sure we set the default OpenCL environment back before we delete…
Browse files Browse the repository at this point in the history
… the temporary one.

The default OpenCL environment should always have a library.
  • Loading branch information
dlemstra committed Dec 5, 2016
1 parent 95f9bcc commit 6e764b1
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions magick/opencl.c
Original file line number Diff line number Diff line change
Expand Up @@ -2364,10 +2364,10 @@ static ds_status AcceleratePerfEvaluator(ds_device *device,
#define NUM_ITER 2
#define ReturnStatus(status) \
{ \
if (clEnv!=NULL) \
RelinquishMagickOpenCLEnv(clEnv); \
if (oldClEnv!=NULL) \
defaultCLEnv = oldClEnv; \
if (oldClEnv != (MagickCLEnv) NULL) \
defaultCLEnv=oldClEnv; \
if (clEnv != (MagickCLEnv) NULL) \
(void) RelinquishMagickOpenCLEnv(clEnv); \
return status; \
}

Expand Down Expand Up @@ -2582,6 +2582,8 @@ static MagickBooleanType autoSelectDevice(MagickCLEnv clEnv, ExceptionInfo* exce
goto cleanup;
}

clEnv->library=OpenCLLib;

status = initDSProfile(&profile, IMAGEMAGICK_PROFILE_VERSION);
if (status!=DS_SUCCESS) {
(void) ThrowMagickException(exception, GetMagickModule(), ModuleFatalError, "Error when initializing the profile", "'%s'", ".");
Expand Down

0 comments on commit 6e764b1

Please sign in to comment.