ekiga r7419 - trunk/lib/engine/components/opal
- From: jpuydt svn gnome org
- To: svn-commits-list gnome org
- Subject: ekiga r7419 - trunk/lib/engine/components/opal
- Date: Tue, 25 Nov 2008 19:19:04 +0000 (UTC)
Author: jpuydt
Date: Tue Nov 25 19:19:03 2008
New Revision: 7419
URL: http://svn.gnome.org/viewvc/ekiga?rev=7419&view=rev
Log:
Made the opal code use gmref_ptr too
Modified:
trunk/lib/engine/components/opal/sip-chat-simple.cpp
trunk/lib/engine/components/opal/sip-chat-simple.h
trunk/lib/engine/components/opal/sip-dialect.cpp
trunk/lib/engine/components/opal/sip-dialect.h
trunk/lib/engine/components/opal/sip-endpoint.cpp
trunk/lib/engine/components/opal/sip-endpoint.h
Modified: trunk/lib/engine/components/opal/sip-chat-simple.cpp
==============================================================================
--- trunk/lib/engine/components/opal/sip-chat-simple.cpp (original)
+++ trunk/lib/engine/components/opal/sip-chat-simple.cpp Tue Nov 25 19:19:03 2008
@@ -67,15 +67,15 @@
}
void
-SIP::SimpleChat::connect (Ekiga::ChatObserver& observer)
+SIP::SimpleChat::connect (gmref_ptr<Ekiga::ChatObserver> observer)
{
- observers.push_front (&observer);
+ observers.push_front (observer);
}
void
-SIP::SimpleChat::disconnect (Ekiga::ChatObserver& observer)
+SIP::SimpleChat::disconnect (gmref_ptr<Ekiga::ChatObserver> observer)
{
- observers.remove (&observer);
+ observers.remove (observer);
if (observers.empty ())
removed.emit ();
@@ -87,8 +87,7 @@
bool result;
gmref_ptr<Ekiga::PersonalDetails> personal = core.get ("personal-details");
result = sender (msg);
- for (std::list<Ekiga::ChatObserver*>::iterator iter
- = observers.begin ();
+ for (std::list<gmref_ptr<Ekiga::ChatObserver> >::iterator iter = observers.begin ();
iter != observers.end ();
++iter)
(*iter)->message (personal->get_display_name (), msg);
@@ -98,8 +97,7 @@
void
SIP::SimpleChat::receive_message (const std::string msg)
{
- for (std::list<Ekiga::ChatObserver*>::iterator iter
- = observers.begin ();
+ for (std::list<gmref_ptr<Ekiga::ChatObserver> >::iterator iter = observers.begin ();
iter != observers.end ();
++iter)
(*iter)->message (presentity->get_name (), msg);
@@ -108,8 +106,7 @@
void
SIP::SimpleChat::receive_notice (const std::string msg)
{
- for (std::list<Ekiga::ChatObserver*>::iterator iter
- = observers.begin ();
+ for (std::list<gmref_ptr<Ekiga::ChatObserver> >::iterator iter = observers.begin ();
iter != observers.end ();
++iter)
(*iter)->notice (msg);
Modified: trunk/lib/engine/components/opal/sip-chat-simple.h
==============================================================================
--- trunk/lib/engine/components/opal/sip-chat-simple.h (original)
+++ trunk/lib/engine/components/opal/sip-chat-simple.h Tue Nov 25 19:19:03 2008
@@ -57,9 +57,9 @@
const std::string get_title () const;
- void connect (Ekiga::ChatObserver& observer);
+ void connect (gmref_ptr<Ekiga::ChatObserver> observer);
- void disconnect (Ekiga::ChatObserver& observer);
+ void disconnect (gmref_ptr<Ekiga::ChatObserver> observer);
bool send_message (const std::string msg);
@@ -75,7 +75,7 @@
Ekiga::ServiceCore& core;
sigc::slot1<bool, std::string> sender;
- std::list<Ekiga::ChatObserver*> observers;
+ std::list<gmref_ptr<Ekiga::ChatObserver> > observers;
gmref_ptr<Ekiga::Presentity> presentity;
std::string uri;
};
Modified: trunk/lib/engine/components/opal/sip-dialect.cpp
==============================================================================
--- trunk/lib/engine/components/opal/sip-dialect.cpp (original)
+++ trunk/lib/engine/components/opal/sip-dialect.cpp Tue Nov 25 19:19:03 2008
@@ -54,7 +54,7 @@
const std::string name,
const std::string msg)
{
- SimpleChat *chat = NULL;
+ gmref_ptr<SimpleChat> chat;
chat = open_chat_with (uri, name, false);
@@ -66,7 +66,7 @@
const std::string name,
const std::string msg)
{
- SimpleChat *chat = NULL;
+ gmref_ptr<SimpleChat> chat;
chat = open_chat_with (uri, name, false);
@@ -86,22 +86,22 @@
(void)open_chat_with (uri, name, true);
}
-SIP::SimpleChat*
+gmref_ptr<SIP::SimpleChat>
SIP::Dialect::open_chat_with (std::string uri,
std::string name,
bool user_request)
{
- SimpleChat *result = NULL;
+ gmref_ptr<SimpleChat> result;
for (simple_iterator iter = simple_begin ();
iter != simple_end ();
++iter)
- if (iter->get_uri () == uri)
- result = &*iter;
+ if ((*iter)->get_uri () == uri)
+ result = *iter;
- if (result == NULL) {
+ if ( !result) {
- result = new SimpleChat (core, name, uri, sigc::bind<0>(sender, uri));
+ result = gmref_ptr<SimpleChat> (new SimpleChat (core, name, uri, sigc::bind<0>(sender, uri)));
add_simple_chat (result);
}
Modified: trunk/lib/engine/components/opal/sip-dialect.h
==============================================================================
--- trunk/lib/engine/components/opal/sip-dialect.h (original)
+++ trunk/lib/engine/components/opal/sip-dialect.h Tue Nov 25 19:19:03 2008
@@ -70,9 +70,9 @@
/* the strings are : uri then msg */
sigc::slot2<bool, std::string, std::string> sender;
- SimpleChat* open_chat_with (std::string uri,
- std::string name,
- bool user_request);
+ gmref_ptr<SimpleChat> open_chat_with (std::string uri,
+ std::string name,
+ bool user_request);
};
};
Modified: trunk/lib/engine/components/opal/sip-endpoint.cpp
==============================================================================
--- trunk/lib/engine/components/opal/sip-endpoint.cpp (original)
+++ trunk/lib/engine/components/opal/sip-endpoint.cpp Tue Nov 25 19:19:03 2008
@@ -140,7 +140,8 @@
listen_port = _listen_port;
dialect = new SIP::Dialect (core, sigc::mem_fun (this, &Opal::Sip::EndPoint::send_message));
- chat_core->add_dialect (*dialect);
+ dialect->reference (); // take a reference in the main thread
+ chat_core->add_dialect (gmref_ptr<SIP::Dialect>(dialect));
/* Timeouts */
SetAckTimeout (PTimeInterval (0, 32));
@@ -171,7 +172,7 @@
{
runtime->unreference (); // leave a reference in the main thread
account_core->unreference (); // leave a reference in the main thread
- delete dialect;
+ dialect->unreference (); // leave a reference in the main thread
}
Modified: trunk/lib/engine/components/opal/sip-endpoint.h
==============================================================================
--- trunk/lib/engine/components/opal/sip-endpoint.h (original)
+++ trunk/lib/engine/components/opal/sip-endpoint.h Tue Nov 25 19:19:03 2008
@@ -193,7 +193,7 @@
unsigned listen_port;
- SIP::Dialect *dialect;
+ SIP::Dialect* dialect;
std::map<std::string, std::pair <std::string, std::string> > uri_presences;
};
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]