[PATCH 11/15] Have Object subclasses NOT throw exceptions in destructors.
From: qolyester@green-communications.fr
This commit is contained in:
parent
d14c15246b
commit
2a1e2dbe51
4 changed files with 20 additions and 12 deletions
|
@ -140,7 +140,7 @@ public:
|
|||
* \param rule Textual form of match rule.
|
||||
* \throw Error
|
||||
*/
|
||||
void remove_match( const char* rule );
|
||||
void remove_match( const char* rule, bool throw_on_error );
|
||||
|
||||
/*!
|
||||
* \brief Adds a message filter.
|
||||
|
|
|
@ -60,7 +60,7 @@ private:
|
|||
|
||||
DXXAPILOCAL virtual bool handle_message(const Message &) = 0;
|
||||
DXXAPILOCAL virtual void register_obj() = 0;
|
||||
DXXAPILOCAL virtual void unregister_obj() = 0;
|
||||
DXXAPILOCAL virtual void unregister_obj(bool throw_on_error = true) = 0;
|
||||
|
||||
private:
|
||||
|
||||
|
@ -168,7 +168,7 @@ private:
|
|||
bool handle_message(const Message &);
|
||||
|
||||
void register_obj();
|
||||
void unregister_obj();
|
||||
void unregister_obj(bool throw_on_error = true);
|
||||
|
||||
typedef std::map<const Tag *, Continuation *> ContinuationMap;
|
||||
ContinuationMap _continuations;
|
||||
|
@ -217,7 +217,7 @@ private:
|
|||
bool handle_message(const Message &);
|
||||
|
||||
void register_obj();
|
||||
void unregister_obj();
|
||||
void unregister_obj(bool throw_on_error = true);
|
||||
|
||||
private:
|
||||
|
||||
|
|
|
@ -329,7 +329,8 @@ void Connection::add_match(const char *rule)
|
|||
if (e) throw Error(e);
|
||||
}
|
||||
|
||||
void Connection::remove_match(const char *rule)
|
||||
void Connection::remove_match(const char *rule,
|
||||
bool throw_on_error)
|
||||
{
|
||||
InternalError e;
|
||||
|
||||
|
@ -337,7 +338,14 @@ void Connection::remove_match(const char *rule)
|
|||
|
||||
debug_log("%s: removed match rule %s", unique_name(), rule);
|
||||
|
||||
if (e) throw Error(e);
|
||||
if (e) {
|
||||
if (throw_on_error)
|
||||
throw Error(e);
|
||||
else
|
||||
debug_log("DBus::Connection::remove_match: %s (%s).",
|
||||
static_cast<DBusError*>(e)->message,
|
||||
static_cast<DBusError*>(e)->name);
|
||||
}
|
||||
}
|
||||
|
||||
bool Connection::add_filter(MessageSlot &s)
|
||||
|
|
|
@ -164,7 +164,7 @@ ObjectAdaptor::ObjectAdaptor(Connection &conn, const Path &path)
|
|||
|
||||
ObjectAdaptor::~ObjectAdaptor()
|
||||
{
|
||||
unregister_obj();
|
||||
unregister_obj(false);
|
||||
}
|
||||
|
||||
void ObjectAdaptor::register_obj()
|
||||
|
@ -179,7 +179,7 @@ void ObjectAdaptor::register_obj()
|
|||
_adaptor_table[path()] = this;
|
||||
}
|
||||
|
||||
void ObjectAdaptor::unregister_obj()
|
||||
void ObjectAdaptor::unregister_obj(bool)
|
||||
{
|
||||
_adaptor_table.erase(path());
|
||||
|
||||
|
@ -295,7 +295,7 @@ ObjectProxy::ObjectProxy(Connection &conn, const Path &path, const char *service
|
|||
|
||||
ObjectProxy::~ObjectProxy()
|
||||
{
|
||||
unregister_obj();
|
||||
unregister_obj(false);
|
||||
}
|
||||
|
||||
void ObjectProxy::register_obj()
|
||||
|
@ -315,7 +315,7 @@ void ObjectProxy::register_obj()
|
|||
}
|
||||
}
|
||||
|
||||
void ObjectProxy::unregister_obj()
|
||||
void ObjectProxy::unregister_obj(bool throw_on_error)
|
||||
{
|
||||
debug_log("unregistering remote object %s", path().c_str());
|
||||
|
||||
|
@ -323,7 +323,7 @@ void ObjectProxy::unregister_obj()
|
|||
while (ii != _interfaces.end())
|
||||
{
|
||||
std::string im = "type='signal',interface='"+ii->first+"',path='"+path()+"'";
|
||||
conn().remove_match(im.c_str());
|
||||
conn().remove_match(im.c_str(), throw_on_error);
|
||||
++ii;
|
||||
}
|
||||
conn().remove_filter(_filtered);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue