Hello, this is my first question in this mailing list.
I have a problem:
I want to call Java callback from my cpp application.
I created callback in cpp and using director and swig the relevant class was created in Java automatically.
This callback is called twice: 
1. When the context is java thread context - this works great.
2. When the context is the cpp context.- the application collapses with segmentation fault.

I debugged this and found out that in the wrapper_cxx file, in the relevant function, it collapses when swig_get_self(jenv) is executed.
After reading a lot on the internet, I understand that the problem is that the right java thread is not attached. I also understand what I have to do manually.

I would like to know what solution does the swig give me automatically.
I would be greatful for your responses
Hadas