[perl-Gtk2] Fix incorrect memory management in Gtk2::Gdk::Display::list_devices



commit 4856da628ce37099b27b66a88141dc6daad693b0
Author: Torsten Schönfeld <kaffeetisch gmx de>
Date:   Sat Jan 17 14:59:24 2015 +0100

    Fix incorrect memory management in Gtk2::Gdk::Display::list_devices
    
    We do not own the returned list.

 NEWS             |    5 +++++
 t/GdkDisplay.t   |    4 +++-
 xs/GdkDisplay.xs |    2 --
 3 files changed, 8 insertions(+), 3 deletions(-)
---
diff --git a/NEWS b/NEWS
index a19319e..558cb5d 100644
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,8 @@
+Overview of changes in Gtk2 <next>
+==================================
+
+* Fix incorrect memory management in Gtk2::Gdk::Display::list_devices
+
 Overview of changes in Gtk2 1.2494
 ==================================
 
diff --git a/t/GdkDisplay.t b/t/GdkDisplay.t
index d290446..f4aef59 100644
--- a/t/GdkDisplay.t
+++ b/t/GdkDisplay.t
@@ -1,7 +1,7 @@
 #!/usr/bin/perl -w
 use strict;
 use Gtk2::TestHelper
-  tests => 26,
+  tests => 27,
   at_least_version => [2, 2, 0, "GdkDisplay is new in 2.2"];
 
 # $Id$
@@ -32,6 +32,8 @@ ok(!$display -> pointer_is_grabbed());
 # $display -> beep();
 $display -> sync();
 
+# Do this twice to ensure we did not damage the list.
+isa_ok(($display -> list_devices())[0], "Gtk2::Gdk::Device");
 isa_ok(($display -> list_devices())[0], "Gtk2::Gdk::Device");
 
 $display -> put_event(Gtk2::Gdk::Event -> new("button-press"));
diff --git a/xs/GdkDisplay.xs b/xs/GdkDisplay.xs
index f558f1d..a019eee 100644
--- a/xs/GdkDisplay.xs
+++ b/xs/GdkDisplay.xs
@@ -69,8 +69,6 @@ gdk_display_list_devices (display)
        devices = gdk_display_list_devices (display);
        for (i = devices ; i != NULL ; i = i->next)
                XPUSHs (sv_2mortal (newSVGdkDevice (i->data)));
-       g_list_free (devices);
-       
 
 GdkEvent* gdk_display_get_event (GdkDisplay *display) 
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]