Hi:

I'm new to Symbian development and would like to solicit some advice for this problem I have.

I'm writing a multi-threaded application that utilizes a shared queue synchronized with mutexes. Basically, several threads are pushing items into the queue, and one thread is popping items off. When the push function is called I allocate a new item with the new operator. When the pop function is called, I remove the item from the queue and call delete on it. Whenever I run the program I get a USER panic #42, which is described in the documentation thus:

This panic is raised by a number of RHeap member functions, AllocLen(), Free(), FreeZ(), ReAlloc(), ReAllocL(), Adjust() and AdjustL() when a pointer passed to these functions does not point to a valid cell.

After some deliberation I've come to attribute this panic to the fact that the new items resulting from pushes are being allocated on the heap of the thread that is calling the push function, which is different from the thread calling the pop function and trying to delete the pointer from its own heap. Is this correct? And if so, how can I fix this situation?

Thanks for the help.

Joseph