diff --git a/src/message.cpp b/src/message.cpp index 1afee6b..2363207 100644 --- a/src/message.cpp +++ b/src/message.cpp @@ -384,7 +384,9 @@ Message& Message::operator = ( const Message& m ) { if(&m != this) { + dbus_message_unref(_pvt->msg); _pvt = m._pvt; + dbus_message_ref(_pvt->msg); } return *this; } diff --git a/src/object.cpp b/src/object.cpp index 092e5d4..31b9ed1 100644 --- a/src/object.cpp +++ b/src/object.cpp @@ -175,6 +175,11 @@ void ObjectAdaptor::_emit_signal( SignalMessage& sig ) conn().send(sig); } +struct ReturnLaterError +{ + const Tag* tag; +}; + bool ObjectAdaptor::handle_message( const Message& msg ) { switch( msg.type() ) @@ -200,9 +205,9 @@ bool ObjectAdaptor::handle_message( const Message& msg ) ErrorMessage em(cmsg, e.name(), e.message()); conn().send(em); } - catch(Tag* tag) + catch(ReturnLaterError& rle) { - _continuations[tag] = new Continuation(conn(), cmsg, tag); + _continuations[rle.tag] = new Continuation(conn(), cmsg, rle.tag); } return true; } @@ -220,7 +225,8 @@ bool ObjectAdaptor::handle_message( const Message& msg ) void ObjectAdaptor::return_later( const Tag* tag ) { - throw tag; + ReturnLaterError rle = { tag }; + throw rle; } void ObjectAdaptor::return_now( Continuation* ret )