This is an automated email from the git hooks/post-receive script.

intrigeri pushed a commit to branch experimental
in repository libnet-dbus-perl.

commit 51c4f20794b925e30ec14b4519c566c3779a9c78
Author: Frank Szczerba <fr...@szczerba.net>
Date:   Sun Nov 6 14:59:46 2011 +0000

    Fix leaks in handling async methods / pending calls (rt #71943)
---
 AUTHORS                    | 2 ++
 DBus.xs                    | 6 ++++--
 lib/Net/DBus/ASyncReply.pm | 6 ++++--
 3 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/AUTHORS b/AUTHORS
index dd23fc4..78352b9 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -16,6 +16,8 @@ from
     Stefan Pfetzing <dream...@dreamind.de>
     Pavel Strashkin <pavel.strash...@gmail.com>
     Mathieu Bridon <boche...@fedoraproject.org>
+    Frank Szczerba <fr...@szczerba.net>
+
 
     [...send patches to get your name here!]
 
diff --git a/DBus.xs b/DBus.xs
index 4291759..5295eb6 100644
--- a/DBus.xs
+++ b/DBus.xs
@@ -344,7 +344,8 @@ _pending_call_callback(DBusPendingCall *call,
     DEBUG_MSG("In pending call callback %p\n", call);
     selfref = (SV*)dbus_pending_call_get_data(call, pending_call_data_slot);
 
-    dbus_pending_call_ref(call);
+    // Why was this here? It makes the call object leak. - FCS
+    //dbus_pending_call_ref(call);
 
     ENTER;
     SAVETMPS;
@@ -366,6 +367,7 @@ _filter_release(void *data) {
 
 void
 _pending_call_notify_release(void *data) {
+    DEBUG_MSG("In pending call notify release %p\n", data);
     SvREFCNT_dec(data);
 }
 
@@ -1188,7 +1190,7 @@ void
 DESTROY (call)
        DBusPendingCall *call;
     CODE:
-       DEBUG_MSG("Unrefing pending call %p", call);
+       DEBUG_MSG("Unrefing pending call %p\n", call);
        dbus_pending_call_unref(call);
 
 MODULE = Net::DBus::Binding::C::Watch                  PACKAGE = 
Net::DBus::Binding::C::Watch
diff --git a/lib/Net/DBus/ASyncReply.pm b/lib/Net/DBus/ASyncReply.pm
index ca526c8..c8bc55d 100644
--- a/lib/Net/DBus/ASyncReply.pm
+++ b/lib/Net/DBus/ASyncReply.pm
@@ -84,8 +84,9 @@ calling this method, this object should not be used again.
 
 sub discard_result {
     my $self = shift;
+    my $pending_call = delete $self->{pending_call};
 
-    $self->{pending_call}->cancel;
+    $pending_call->cancel;
 }
 
 
@@ -151,8 +152,9 @@ object should no longer be used.
 
 sub get_result {
     my $self = shift;
+    my $pending_call = delete $self->{pending_call};
 
-    my $reply = $self->{pending_call}->get_reply;
+    my $reply = $pending_call->get_reply;
 
     if ($reply->isa("Net::DBus::Binding::Message::Error")) {
        my $iter = $reply->iterator();

-- 
Alioth's /usr/local/bin/git-commit-notice on 
/srv/git.debian.org/git/pkg-perl/packages/libnet-dbus-perl.git

_______________________________________________
Pkg-perl-cvs-commits mailing list
Pkg-perl-cvs-commits@lists.alioth.debian.org
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-perl-cvs-commits

Reply via email to