Fix leaks of Pango objects (bz 660216)

This commit is contained in:
leigh123linux 2016-04-17 11:13:34 +01:00
parent e257722d02
commit 461f24bbc5
2 changed files with 83 additions and 24 deletions

View File

@ -0,0 +1,63 @@
From eca72baa5616fbe4dbebea43c7e5940847dc5ab8 Mon Sep 17 00:00:00 2001
From: "Owen W. Taylor" <otaylor@fishsoup.net>
Date: Tue, 27 Sep 2011 00:17:52 -0400
Subject: [PATCH 1/2] Fix leaks of Pango objects
Gtk.PrintContext.create_pango_context()
Gtk.PrintContext.create_pango_layout()
pangocairo.CairoContext.create_layout()
were leaking the objects they returned.
https://bugzilla.gnome.org/show_bug.cgi?id=660216
---
gtk/gtk-2.10.defs | 2 ++
pangocairo.override | 11 ++++++++---
2 files changed, 10 insertions(+), 3 deletions(-)
diff --git a/gtk/gtk-2.10.defs b/gtk/gtk-2.10.defs
index 69c7e0c..faa45e1 100644
--- a/gtk/gtk-2.10.defs
+++ b/gtk/gtk-2.10.defs
@@ -1388,12 +1388,14 @@
(define-method create_pango_context
(of-object "GtkPrintContext")
(c-name "gtk_print_context_create_pango_context")
+ (caller-owns-return #t)
(return-type "PangoContext*")
)
(define-method create_pango_layout
(of-object "GtkPrintContext")
(c-name "gtk_print_context_create_pango_layout")
+ (caller-owns-return #t)
(return-type "PangoLayout*")
)
diff --git a/pangocairo.override b/pangocairo.override
index bb923e6..5101107 100644
--- a/pangocairo.override
+++ b/pangocairo.override
@@ -118,11 +118,16 @@ _wrap_pango_cairo_update_context(PyGObject *self, PyObject *args, PyObject *kwar
static PyObject *
_wrap_pango_cairo_create_layout(PyGObject *self)
{
- PangoLayout *ret;
+ PangoLayout *layout;
+ PyObject *ret;
- ret = pango_cairo_create_layout(PycairoContext_GET(self));
+ layout = pango_cairo_create_layout(PycairoContext_GET(self));
/* pygobject_new handles NULL checking */
- return pygobject_new((GObject *)ret);
+ ret = pygobject_new((GObject *)layout);
+ if (layout)
+ g_object_unref(layout);
+
+ return ret;
}
static PyObject *
--
2.5.5

View File

@ -13,7 +13,7 @@
Name: pygtk2
Version: 2.24.0
Release: 13%{?dist}
Release: 14%{?dist}
License: LGPLv2+
Group: Development/Languages
Summary: Python bindings for GTK+
@ -21,6 +21,9 @@ URL: http://www.pygtk.org/
Source: http://ftp.gnome.org/pub/GNOME/sources/pygtk/2.24/pygtk-%{version}.tar.bz2
### Patches ###
# https://bugzilla.gnome.org/show_bug.cgi?id=660216
# https://git.gnome.org/browse/pygtk/commit/?id=eca72baa56
Patch0: 0001-Fix-leaks-of-Pango-objects.patch
# This was dropped from gnome-python; obsolete it here because, well,
@ -78,7 +81,6 @@ Group: Development/Languages
Requires: %{name} = %{version}-%{release}
Requires: %{name}-codegen = %{version}-%{release}
Requires: %{name}-doc = %{version}-%{release}
Requires: pkgconfig
Requires: pycairo-devel
Requires: pygobject2-devel
@ -96,30 +98,26 @@ This package contains documentation files for %{name}.
%prep
%setup -q -n pygtk-%{version}
%patch0 -p1 -b .Fix-leaks-of-Pango-objects
%build
%configure --enable-thread --enable-numpy
make %{?_smp_mflags}
%{make_build}
%install
%{make_install}
find $RPM_BUILD_ROOT -name '*.la' -or -name '*.a' | xargs rm -f
find %{buildroot} -name '*.la' -or -name '*.a' | xargs rm -f
%files
%doc AUTHORS NEWS README MAPPING
%license COPYING
%{_bindir}/pygtk-demo
%{_libdir}/pygtk/
%dir %{python_sitearch}/gtk-2.0
%dir %{python_sitearch}/gtk-2.0/gtk
%{python_sitearch}/gtk-2.0/gtk/*.py*
%dir %{_libdir}/pygtk
%dir %{_libdir}/pygtk/2.0
%{_libdir}/pygtk/2.0/*
%{_bindir}/pygtk-demo
%{python_sitearch}/gtk-2.0/atk.so
%{python_sitearch}/gtk-2.0/pango.so
%{python_sitearch}/gtk-2.0/gtk/_gtk.so
%{python_sitearch}/gtk-2.0/gtkunixprint.so
%{python_sitearch}/gtk-2.0/pangocairo.so
%{python_sitearch}/gtk-2.0/*.so
%if %{buildglade}
%files libglade
@ -127,24 +125,22 @@ find $RPM_BUILD_ROOT -name '*.la' -or -name '*.a' | xargs rm -f
%endif
%files codegen
%{_prefix}/bin/pygtk-codegen-2.0
%{_bindir}/pygtk-codegen-2.0
%files devel
%dir %{_prefix}/include/pygtk-2.0
%dir %{_prefix}/include/pygtk-2.0/pygtk
%{_prefix}/include/pygtk-2.0/pygtk/*.h
%{_includedir}/pygtk-2.0/
%{_libdir}/pkgconfig/pygtk-2.0.pc
%dir %{_prefix}/share/pygtk
%dir %{_prefix}/share/pygtk/2.0
%dir %{_prefix}/share/pygtk/2.0/defs
%{_prefix}/share/pygtk/2.0/defs/*.defs
%{_prefix}/share/pygtk/2.0/defs/pangocairo.override
%{_datadir}/pygtk/
%files doc
%doc examples
%{_datadir}/gtk-doc/html/pygtk
%{_datadir}/gtk-doc/html/pygtk/
%changelog
* Sun Apr 17 2016 Leigh Scott <leigh123linux@googlemail.com> - 2.24.0-14
- Fix leaks of Pango objects (bz 660216)
- Update macros in files section
* Thu Feb 04 2016 Fedora Release Engineering <releng@fedoraproject.org> - 2.24.0-13
- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild
@ -164,7 +160,7 @@ find $RPM_BUILD_ROOT -name '*.la' -or -name '*.a' | xargs rm -f
* Sun Aug 04 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 2.24.0-8
- Rebuilt for https://fedoraproject.org/wiki/Fedora_20_Mass_Rebuild
* Tue Mar 02 2013 Colin Walters <walters@verbum.org> - 2.24.0-7
* Sat Mar 02 2013 Colin Walters <walters@verbum.org> - 2.24.0-7
- Patch from mbarnes to hopefully fix multilib conflict
* Thu Feb 14 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 2.24.0-6
@ -416,7 +412,7 @@ find $RPM_BUILD_ROOT -name '*.la' -or -name '*.a' | xargs rm -f
python support is added
- Add a Requires on python-numeric as well
* Tue Aug 18 2005 John (J5) Palmieri <johnp@redhat.com> - 2.7.3-2
* Thu Aug 18 2005 John (J5) Palmieri <johnp@redhat.com> - 2.7.3-2
- Bump and rebuild for cairo ABI changes
* Wed Aug 10 2005 <jrb@redhat.com> - 2.7.3-1