OpenCL issue with clRelease functions

Hi,

I have an issue with clRelease functions (clReleaseContext, …). I developped a C++ library to manage easily OpenCL functions and a test application to control its working.

This application works fine and all clRelease functions are call with success.

Then I developped an other library that uses the first lib to use OpenCL and a test application to control its working.

This application stops when I try to enter in the first clRelease functions namely clReleaseContext.

The same problem appears with Intel and NVidia OpenCL driver. So this is not a driver problem but a usage problem.

To summarize:

OpenCL → LIB_A → TEST_APP_A : OK

OpenCL → LIB_A → LIB_B → TEST_APP_B : not OK

Is someone could help me to find the problem?

Thanks.

I found a solution but I still don’t understand the problem.

Here is the architecture:

class A is a singleton and creates the context.
class B is a singleton and have the member static A* instance.

If I remove the static member of A* in class B and I give the instantiation of A to other functions calls to clRelease functions work fine.

So this is the only way to avoid the issue, but I don’t understand why I can’t have a static instantiation of a singleton in a class.

Thanks.

have you ever checked the clRetainContext ?
possibly could answer your problem.