ekiga r6783 - in trunk: . lib/engine/framework src/endpoints
- From: dsandras svn gnome org
- To: svn-commits-list gnome org
- Subject: ekiga r6783 - in trunk: . lib/engine/framework src/endpoints
- Date: Mon, 1 Sep 2008 19:54:36 +0000 (UTC)
Author: dsandras
Date: Mon Sep 1 19:54:35 2008
New Revision: 6783
URL: http://svn.gnome.org/viewvc/ekiga?rev=6783&view=rev
Log:
Added emit_signal_in_main to fix thread-safety problem with signals in
trackable objects thanks to Snark. Use the new method where needed.
Modified:
trunk/ChangeLog
trunk/lib/engine/framework/runtime.h
trunk/src/endpoints/opal-call.cpp
Modified: trunk/lib/engine/framework/runtime.h
==============================================================================
--- trunk/lib/engine/framework/runtime.h (original)
+++ trunk/lib/engine/framework/runtime.h Mon Sep 1 19:54:35 2008
@@ -41,6 +41,19 @@
#include "services.h"
+template<typename data_type>
+static void emit_signal_in_main_helper1 (sigc::signal<void, data_type> sign,
+ data_type data)
+{
+ sign.emit (data);
+}
+
+static void emit_signal_in_main_helper (sigc::signal<void> sign)
+
+{
+ sign.emit ();
+}
+
namespace Ekiga
{
@@ -55,10 +68,10 @@
public:
Runtime ()
- {}
+ {}
virtual ~Runtime ()
- {}
+ {}
const std::string get_name () const
{ return "runtime"; }
@@ -72,6 +85,19 @@
virtual void run_in_main (sigc::slot<void> action,
unsigned int seconds = 0) = 0;
+
+
+ void emit_signal_in_main (sigc::signal<void> sign)
+ {
+ run_in_main (sigc::bind (sigc::ptr_fun (emit_signal_in_main_helper), sign));
+ }
+
+ template<typename data_type>
+ void emit_signal_in_main (sigc::signal<void, data_type> sign,
+ data_type data)
+ {
+ run_in_main (sigc::bind (sigc::ptr_fun (emit_signal_in_main_helper1<data_type>), sign, data));
+ }
};
/**
Modified: trunk/src/endpoints/opal-call.cpp
==============================================================================
--- trunk/src/endpoints/opal-call.cpp (original)
+++ trunk/src/endpoints/opal-call.cpp Mon Sep 1 19:54:35 2008
@@ -334,7 +334,7 @@
if (!PIsDescendant(&connection, OpalPCSSConnection)) {
parse_info (connection);
- runtime.run_in_main (established.make_slot ());
+ runtime.emit_signal_in_main (established);
}
if (PIsDescendant(&connection, OpalRTPConnection)) {
@@ -383,7 +383,7 @@
&& !is_outgoing ()
&& GetCallEndReason () != OpalConnection::EndedByAnswerDenied) {
- runtime.run_in_main (missed.make_slot ());
+ runtime.emit_signal_in_main (missed);
}
else {
@@ -465,7 +465,7 @@
reason = _("Call completed");
}
- runtime.run_in_main (sigc::bind (cleared.make_slot (), reason));
+ runtime.emit_signal_in_main (cleared, reason);
}
}
@@ -487,7 +487,7 @@
{
parse_info (connection);
- runtime.run_in_main (setup.make_slot ());
+ runtime.emit_signal_in_main (setup);
call_setup = true;
cleared.connect (sigc::mem_fun (this, &Opal::Call::on_cleared_call));
@@ -503,9 +503,9 @@
bool on_hold)
{
if (on_hold)
- runtime.run_in_main (held.make_slot ());
+ runtime.emit_signal_in_main (held);
else
- runtime.run_in_main (retrieved.make_slot ());
+ runtime.emit_signal_in_main (retrieved);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]