[ekiga] Fixed possible threading issues in the PTLIB video input code



commit 42b3688718f4d569f3eede795a2446ad42c5bbe1
Author: Julien Puydt <jpuydt noether localdomain>
Date:   Tue Apr 21 17:06:56 2009 +0200

    Fixed possible threading issues in the PTLIB video input code
    
    don't use make_slot in threads
---
 .../components/ptlib/videoinput-manager-ptlib.cpp  |   26 +++++++++++++++++--
 .../components/ptlib/videoinput-manager-ptlib.h    |    7 +++++
 2 files changed, 30 insertions(+), 3 deletions(-)

diff --git a/lib/engine/components/ptlib/videoinput-manager-ptlib.cpp b/lib/engine/components/ptlib/videoinput-manager-ptlib.cpp
index 87ec2ee..aacb497 100644
--- a/lib/engine/components/ptlib/videoinput-manager-ptlib.cpp
+++ b/lib/engine/components/ptlib/videoinput-manager-ptlib.cpp
@@ -143,7 +143,7 @@ bool GMVideoInputManager_ptlib::open (unsigned width, unsigned height, unsigned
 
   if (error_code != Ekiga::VI_ERROR_NONE) {
     PTRACE(1, "GMVideoInputManager_ptlib\tEncountered error " << error_code << " while opening device ");
-    Ekiga::Runtime::run_in_main (sigc::bind (device_error.make_slot (), current_state.device, error_code));
+    Ekiga::Runtime::run_in_main (sigc::bind (sigc::mem_fun (this, &GMVideoInputManager_ptlib::device_error_in_main), current_state.device, error_code));
     return false;
   }
 
@@ -158,7 +158,7 @@ bool GMVideoInputManager_ptlib::open (unsigned width, unsigned height, unsigned
   settings.contrast = contrast >> 8;
   settings.modifyable = true;
 
-  Ekiga::Runtime::run_in_main (sigc::bind (device_opened.make_slot (), current_state.device, settings));
+  Ekiga::Runtime::run_in_main (sigc::bind (sigc::mem_fun (this, &GMVideoInputManager_ptlib::device_opened_in_main), current_state.device, settings));
 
   return true;
 }
@@ -171,7 +171,7 @@ void GMVideoInputManager_ptlib::close()
     input_device = NULL;
   }
   current_state.opened = false;
-  Ekiga::Runtime::run_in_main (sigc::bind (device_closed.make_slot (), current_state.device));
+  Ekiga::Runtime::run_in_main (sigc::bind (sigc::mem_fun (this, &GMVideoInputManager_ptlib::device_closed_in_main), current_state.device));
 }
 
 bool GMVideoInputManager_ptlib::get_frame_data (char *data)
@@ -234,3 +234,23 @@ bool GMVideoInputManager_ptlib::has_device(const std::string & source, const std
   }
   return false;
 }
+
+void
+GMVideoInputManager_ptlib::device_opened_in_main (Ekiga::VideoInputDevice device,
+						  Ekiga::VideoInputSettings settings)
+{
+  device_opened.emit (device, settings);
+}
+
+void
+GMVideoInputManager_ptlib::device_closed_in_main (Ekiga::VideoInputDevice device)
+{
+  device_closed.emit (device);
+}
+
+void
+GMVideoInputManager_ptlib::device_error_in_main (Ekiga::VideoInputDevice device,
+						 Ekiga::VideoInputErrorCodes code)
+{
+  device_error.emit (device, code);
+}
diff --git a/lib/engine/components/ptlib/videoinput-manager-ptlib.h b/lib/engine/components/ptlib/videoinput-manager-ptlib.h
index 3d0e089..91ddb41 100644
--- a/lib/engine/components/ptlib/videoinput-manager-ptlib.h
+++ b/lib/engine/components/ptlib/videoinput-manager-ptlib.h
@@ -80,6 +80,13 @@
       unsigned expectedFrameSize;
 
       PVideoInputDevice *input_device;
+
+    private:
+      void device_opened_in_main (Ekiga::VideoInputDevice device,
+				  Ekiga::VideoInputSettings settings);
+      void device_closed_in_main (Ekiga::VideoInputDevice device);
+      void device_error_in_main (Ekiga::VideoInputDevice device,
+				 Ekiga::VideoInputErrorCodes code);
   };
 /**
  * @}



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]