Package: libgtk2-perl / 2:1.2492-4

Fix-incorrect-memory-management-in-Gtk2-Gdk-Display-list_devices.patch Patch series | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
From: Torsten Schönfeld <kaffeetisch@gmx.de>
Date: Sat, 17 Jan 2015 14:59:24 +0100
Origin: https://git.gnome.org/browse/perl-Gtk2/commit/?id=4856da628ce37099b27b66a88141dc6daad693b0
Applied-Upstream: 1.2495
Subject: Fix incorrect memory management in Gtk2::Gdk::Display::list_devices

We do not own the returned list.
---
 t/GdkDisplay.t   | 4 +++-
 xs/GdkDisplay.xs | 2 --
 2 files changed, 3 insertions(+), 3 deletions(-)

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)