WIN32 master Preview crash on exit

View: New views
4 Messages — Rating Filter:   Alert me  

WIN32 master Preview crash on exit

by Michael Rickmann :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Ok, the next one. As the title says it occurs on exit and only when
video preview is active. The gdb and d4 logs can be found at
http://wwwuser.gwdg.de/~mrickma/ekiga/master-crashes-041009.tar.gz . The
gdb backtraces come in to flavours but both seem to indicate
difficulties around the sequence to shut down video preview,
videoinput-core and videooutput-core. What is the right sequence here ?

I also checked git versions 28ed1-2009-09-05 d6ff5-2009-09-04 and
b4ef10d-2009-08-25, the latter being before boost transition, I think.
The crash happened in all of them.

Is there any indication that this happens under Linux master as well?
Michael
_______________________________________________
Ekiga-devel-list mailing list
Ekiga-devel-list@...
http://mail.gnome.org/mailman/listinfo/ekiga-devel-list

Re: WIN32 master Preview crash on exit

by Julien PUYDT :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Michael Rickmann a écrit :

> Ok, the next one. As the title says it occurs on exit and only when
> video preview is active. The gdb and d4 logs can be found at
> http://wwwuser.gwdg.de/~mrickma/ekiga/master-crashes-041009.tar.gz . The
> gdb backtraces come in to flavours but both seem to indicate
> difficulties around the sequence to shut down video preview,
> videoinput-core and videooutput-core. What is the right sequence here ?
>
> I also checked git versions 28ed1-2009-09-05 d6ff5-2009-09-04 and
> b4ef10d-2009-08-25, the latter being before boost transition, I think.
> The crash happened in all of them.
>
> Is there any indication that this happens under Linux master as well?

I have had crashes on exit since a very, very long time. Failed
assertions in the ptlib threading code, in fact.

Snark
_______________________________________________
Ekiga-devel-list mailing list
Ekiga-devel-list@...
http://mail.gnome.org/mailman/listinfo/ekiga-devel-list

Re: WIN32 master Preview crash on exit

by Michael Rickmann :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I think, I found the reason for the crash. From the sequence of
service_core->add s in lib/engine/engine.cpp follows that
videooutput_core is destructed before videoinput_core, so the preview
shovels data into nothingness. To play it safe I gave the
VideoPreviewManager a boost::shared_ptr of videooutput_core (see
attached patch) and the crash was gone.
I wonder what the difference between Linux and Windows is in this case.
Michael

Julien Puydt schrieb:

> Michael Rickmann a écrit :
>> Ok, the next one. As the title says it occurs on exit and only when
>> video preview is active. The gdb and d4 logs can be found at
>> http://wwwuser.gwdg.de/~mrickma/ekiga/master-crashes-041009.tar.gz .
>> The gdb backtraces come in to flavours but both seem to indicate
>> difficulties around the sequence to shut down video preview,
>> videoinput-core and videooutput-core. What is the right sequence here ?
>>
>> I also checked git versions 28ed1-2009-09-05 d6ff5-2009-09-04 and
>> b4ef10d-2009-08-25, the latter being before boost transition, I think.
>> The crash happened in all of them.
>>
>> Is there any indication that this happens under Linux master as well?
>
> I have had crashes on exit since a very, very long time. Failed
> assertions in the ptlib threading code, in fact.
>
> Snark

diff -ur src/ekiga/lib/engine/engine.cpp ekiga/lib/engine/engine.cpp
--- src/ekiga/lib/engine/engine.cpp 2009-09-01 07:44:32.000000000 +0200
+++ ekiga/lib/engine/engine.cpp 2009-10-06 17:20:31.000000000 +0200
@@ -122,7 +122,7 @@
   boost::shared_ptr<Ekiga::CallCore> call_core (new Ekiga::CallCore);
   boost::shared_ptr<Ekiga::ChatCore> chat_core (new Ekiga::ChatCore);
   boost::shared_ptr<Ekiga::VideoOutputCore> videooutput_core (new Ekiga::VideoOutputCore);
-  boost::shared_ptr<Ekiga::VideoInputCore> videoinput_core (new Ekiga::VideoInputCore(*videooutput_core));
+  boost::shared_ptr<Ekiga::VideoInputCore> videoinput_core (new Ekiga::VideoInputCore(videooutput_core));
   boost::shared_ptr<Ekiga::AudioOutputCore> audiooutput_core (new Ekiga::AudioOutputCore);
   boost::shared_ptr<Ekiga::AudioInputCore> audioinput_core (new Ekiga::AudioInputCore(*audiooutput_core));
   boost::shared_ptr<Ekiga::HalCore> hal_core (new Ekiga::HalCore);
diff -ur src/ekiga/lib/engine/videoinput/videoinput-core.cpp ekiga/lib/engine/videoinput/videoinput-core.cpp
--- src/ekiga/lib/engine/videoinput/videoinput-core.cpp 2009-09-29 06:59:49.000000000 +0200
+++ ekiga/lib/engine/videoinput/videoinput-core.cpp 2009-10-06 17:20:17.000000000 +0200
@@ -44,7 +44,7 @@
 
 using namespace Ekiga;
 
-VideoInputCore::VideoPreviewManager::VideoPreviewManager (VideoInputCore& _videoinput_core, VideoOutputCore& _videooutput_core)
+VideoInputCore::VideoPreviewManager::VideoPreviewManager (VideoInputCore& _videoinput_core, boost::shared_ptr<VideoOutputCore> _videooutput_core)
 : PThread (1000, NoAutoDeleteThread, HighestPriority, "VideoPreviewManager"),
     videoinput_core (_videoinput_core),
   videooutput_core (_videooutput_core)
@@ -77,7 +77,7 @@
   end_thread = false;
   frame = (char*) malloc (unsigned (width * height * 3 / 2));
 
-  videooutput_core.start();
+  videooutput_core->start();
   pause_thread = false;
   run_thread.Signal();
 }
@@ -92,7 +92,7 @@
     free (frame);
     frame = NULL;
   }  
-  videooutput_core.stop();
+  videooutput_core->stop();
 }
 
 void VideoInputCore::VideoPreviewManager::Main ()
@@ -108,7 +108,7 @@
     while (!pause_thread) {
       if (frame) {
         videoinput_core.get_frame_data(frame);
-        videooutput_core.set_frame_data(frame, width, height, true, 1);
+        videooutput_core->set_frame_data(frame, width, height, true, 1);
       }
       // We have to sleep some time outside the mutex lock
       // to give other threads time to get the mutex
@@ -119,7 +119,7 @@
   }
 }
 
-VideoInputCore::VideoInputCore (VideoOutputCore& _videooutput_core)
+VideoInputCore::VideoInputCore (boost::shared_ptr<VideoOutputCore> _videooutput_core)
 :  preview_manager(*this, _videooutput_core)
 {
   PWaitAndSignal m_var(core_mutex);
diff -ur src/ekiga/lib/engine/videoinput/videoinput-core.h ekiga/lib/engine/videoinput/videoinput-core.h
--- src/ekiga/lib/engine/videoinput/videoinput-core.h 2009-09-29 06:59:49.000000000 +0200
+++ ekiga/lib/engine/videoinput/videoinput-core.h 2009-10-06 17:20:24.000000000 +0200
@@ -105,7 +105,7 @@
        * @param _runtime reference to Ekiga runtime.
        * @param _videooutput_core reference ot the video output core.
        */
-      VideoInputCore (VideoOutputCore& _videooutput_core);
+      VideoInputCore (boost::shared_ptr<VideoOutputCore> _videooutput_core);
 
       /** The destructor
        */
@@ -327,7 +327,7 @@
         * @param _videoinput_core reference to the video input core.
         * @param _videooutput_core reference to the video output core.
         */
-        VideoPreviewManager(VideoInputCore & _videoinput_core, VideoOutputCore & _videooutput_core);
+        VideoPreviewManager(VideoInputCore & _videoinput_core, boost::shared_ptr<VideoOutputCore> _videooutput_core);
 
         /** The destructor
         */
@@ -358,7 +358,7 @@
         PSyncPoint run_thread;
 
         VideoInputCore  & videoinput_core;
-        VideoOutputCore & videooutput_core;
+        boost::shared_ptr<VideoOutputCore> videooutput_core;
         unsigned width;
         unsigned height;
       };

_______________________________________________
Ekiga-devel-list mailing list
Ekiga-devel-list@...
http://mail.gnome.org/mailman/listinfo/ekiga-devel-list

Re: WIN32 master Preview crash on exit

by Julien PUYDT :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Michael Rickmann a écrit :
> I think, I found the reason for the crash. From the sequence of
> service_core->add s in lib/engine/engine.cpp follows that
> videooutput_core is destructed before videoinput_core, so the preview
> shovels data into nothingness. To play it safe I gave the
> VideoPreviewManager a boost::shared_ptr of videooutput_core (see
> attached patch) and the crash was gone.
> I wonder what the difference between Linux and Windows is in this case.

I think your patch will work, so I'll apply it, but it's very close to
giving issues :
http://www.boost.org/doc/libs/1_40_0/libs/smart_ptr/shared_ptr.htm#ThreadSafety

Snark
_______________________________________________
Ekiga-devel-list mailing list
Ekiga-devel-list@...
http://mail.gnome.org/mailman/listinfo/ekiga-devel-list