Jump to content

[SOLVED] Bug suspicion in CPUThread


photo

Recommended Posts

Hi everybody,

 

I just ran into a classic borring threads problem when shuting down the engine it 'sometimes' crashes on a bad access => function CPUThread::process(), shader.id = shaders[num].id

I first suspected a bad use from my side but i can't find my error. So i went to suspect something really unusual with Unigine. That's to say 'A Bug' :)

In fact i tracked a bit the execution process, and saw that in the CPUThread destructor the 'running' variable was set to 0 befor emitting the signal (SetEvent) to wake up the process method one last time.

 

Buuut ! as it is in the destructor, the memory space of the thread class will be released just after and the memory can be used again by the system., and the memory pointed by 'running' could differ from zero even if it should not. It seems i fixed the crash in most case with a _WIN32 specific call just after (SetEvent) i put :

 

#ifdef _WIN32
CPUThread::~CPUThread() {
   running = 0;

   // send signal
       SetEvent(event);
       if( thread ) {
  	     WaitForSingleObject(thread,INFINITE);
       }
#else

 

Maybe Unigine team could fix this bug in a better way or at least integrate it in the next update !!

 

Thanks

Link to comment
  • 2 months later...

Hi

I have same problem.

I've attached the callstack, the output messages,unigine log, and world files (very simple)

 

The sebastien fix at the moment works (merci :) )

 

Hope this info can help in some way.

crash on close.zip

Link to comment
×
×
  • Create New...