engobi / libjingle

Automatically exported from code.google.com/p/libjingle
0 stars 0 forks source link

Crash with talk_base::Thread #455

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Build this simple example with libjingle (lib from webrtc project) I use 
standard (unmodified) libjingle from webrtc stable brach (revision 6994). I use 
visual studio 2012 on Windows 8.1 to build this test application.

2. Run the application built in this configuration and a crash (access 
violation will occurr. It took me a lot of time in debbugging to find out that 
the bug occurrs in talk_base::Thread's destructor.

3. I have a proposal for fixing the bug and it is simple solution for the 
problem.

Fix the bug:

Thread::~Thread() {
  Stop();
  if (active_)
  {
+    MessageQueueManager::Remove(this); // Here is the needed fix
    Clear(NULL);
  }
}

4. Rebuild the libjingle with this bug and then rebuild the simple test 
application (the attached main.cc).

5. Run the test application and bug is gone.

6. There is another bug. If you create some threads (talk_base::Thread) and 
then create some message handlers (talk_base::MessageHandler) and then delete 
all the threads. The problem is that when you delete all the threads, the last 
one will destroy talk_base::MessageQueueManager and 
then if you try to delete a single talk_base::MessageHandler it will crash 
because the destructor of the talk_base::MessageHandler uses 
MessageQueueManager.

What is the expected output? What do you see instead?
The expected output is application to run normally. What you see instead is 
that the application crash with access violation.

What version of the product are you using? On what operating system?
We use libjingle (webrtc) from stable branch of webrtc (revision 6994)

Please provide any additional information below.
Everything you need is explaned if README file in the attached archive.

Greetings!

Original issue reported on code.google.com by zub40...@gmail.com on 31 Aug 2014 at 9:51

Attachments: