[Python-modules-commits] r24778 - in packages/pyside/trunk/debian/patches (4 files)
odyx at users.alioth.debian.org
odyx at users.alioth.debian.org
Thu Jun 13 05:18:49 UTC 2013
Date: Thursday, June 13, 2013 @ 05:18:48
Author: odyx
Revision: 24778
Backport 3 commits from upstream to fix build against recent Qt
Added:
packages/pyside/trunk/debian/patches/1.1.2-1-Fix-reference-leak-on-convertion-from-a-C-map-type-t.patch
packages/pyside/trunk/debian/patches/1.1.2-2-Invalidate-metaObject-wrapper-before-deletion.patch
packages/pyside/trunk/debian/patches/1.1.2-3-Use-QObject-property-to-invalidate-wrapper-before-de.patch
Modified:
packages/pyside/trunk/debian/patches/series
Added: packages/pyside/trunk/debian/patches/1.1.2-1-Fix-reference-leak-on-convertion-from-a-C-map-type-t.patch
===================================================================
--- packages/pyside/trunk/debian/patches/1.1.2-1-Fix-reference-leak-on-convertion-from-a-C-map-type-t.patch (rev 0)
+++ packages/pyside/trunk/debian/patches/1.1.2-1-Fix-reference-leak-on-convertion-from-a-C-map-type-t.patch 2013-06-13 05:18:48 UTC (rev 24778)
@@ -0,0 +1,35 @@
+From 6df4b307c5aec758ad954ab8717f5e85b44e2ae5 Mon Sep 17 00:00:00 2001
+From: Hugo Parente Lima <hugo.pl at gmail.com>
+Date: Tue, 11 Sep 2012 10:32:04 -0300
+Subject: [PATCH 1/9] Fix reference leak on convertion from a C++ map type to Python dict.
+
+Patch by Dennis Victorovich.
+
+Change-Id: I050da20f6c0bef2f568aefcc81a9a159a412be24
+Reviewed-by: Hugo Parente Lima <hugo.lima at openbossa.org>
+---
+ PySide/QtCore/typesystem_core_common.xml | 8 +++++---
+ 1 files changed, 5 insertions(+), 3 deletions(-)
+
+diff --git a/PySide/QtCore/typesystem_core_common.xml b/PySide/QtCore/typesystem_core_common.xml
+index d7d0dd9..8888658 100644
+--- a/PySide/QtCore/typesystem_core_common.xml
++++ b/PySide/QtCore/typesystem_core_common.xml
+@@ -658,9 +658,11 @@
+ for (; it != %in.end(); ++it) {
+ %INTYPE_0 key = it.key();
+ %INTYPE_1 value = it.value();
+- PyDict_SetItem(%out,
+- %CONVERTTOPYTHON[%INTYPE_0](key),
+- %CONVERTTOPYTHON[%INTYPE_1](value));
++ PyObject* pyKey = %CONVERTTOPYTHON[%INTYPE_0](key);
++ PyObject* pyValue = %CONVERTTOPYTHON[%INTYPE_1](value);
++ PyDict_SetItem(%out, pyKey, pyValue);
++ Py_DECREF(pyKey);
++ Py_DECREF(pyValue);
+ }
+ return %out;
+ </template>
+--
+1.7.2.5
+
Added: packages/pyside/trunk/debian/patches/1.1.2-2-Invalidate-metaObject-wrapper-before-deletion.patch
===================================================================
--- packages/pyside/trunk/debian/patches/1.1.2-2-Invalidate-metaObject-wrapper-before-deletion.patch (rev 0)
+++ packages/pyside/trunk/debian/patches/1.1.2-2-Invalidate-metaObject-wrapper-before-deletion.patch 2013-06-13 05:18:48 UTC (rev 24778)
@@ -0,0 +1,43 @@
+From aeccd2a05bba8c94a3a338370f16af1d545e8abd Mon Sep 17 00:00:00 2001
+From: John Ehresman <jpe at wingware.com>
+Date: Thu, 20 Dec 2012 11:57:15 -0500
+Subject: [PATCH 2/9] Invalidate metaObject wrapper before deletion
+
+Change-Id: I95d3f8dd4a8473849ca19b5c8d5d59dee4c42991
+Reviewed-by: Hugo Parente Lima <hugo.lima at openbossa.org>
+---
+ libpyside/signalmanager.cpp | 13 +++++++++++--
+ 1 files changed, 11 insertions(+), 2 deletions(-)
+
+diff --git a/libpyside/signalmanager.cpp b/libpyside/signalmanager.cpp
+index d9184eb..b46d1b9 100644
+--- a/libpyside/signalmanager.cpp
++++ b/libpyside/signalmanager.cpp
+@@ -61,13 +61,22 @@ namespace {
+ #ifdef IS_PY3K
+ static void destroyMetaObject(PyObject* obj)
+ {
+- delete reinterpret_cast<PySide::DynamicQMetaObject*>(PyCapsule_GetPointer(obj, 0));
++ void* ptr = PyCapsule_GetPointer(obj, 0);
++ PySide::DynamicQMetaObject* meta = reinterpret_cast<PySide::DynamicQMetaObject*>(ptr);
++ SbkObject* wrapper = Shiboken::BindingManager::instance().retrieveWrapper(meta);
++ if (wrapper)
++ Shiboken::BindingManager::instance().releaseWrapper(wrapper);
++ delete meta;
+ }
+
+ #else
+ static void destroyMetaObject(void* obj)
+ {
+- delete reinterpret_cast<PySide::DynamicQMetaObject*>(obj);
++ PySide::DynamicQMetaObject* meta = reinterpret_cast<PySide::DynamicQMetaObject*>(obj);
++ SbkObject* wrapper = Shiboken::BindingManager::instance().retrieveWrapper(meta);
++ if (wrapper)
++ Shiboken::BindingManager::instance().releaseWrapper(wrapper);
++ delete meta;
+ }
+ #endif
+ }
+--
+1.7.2.5
+
Added: packages/pyside/trunk/debian/patches/1.1.2-3-Use-QObject-property-to-invalidate-wrapper-before-de.patch
===================================================================
--- packages/pyside/trunk/debian/patches/1.1.2-3-Use-QObject-property-to-invalidate-wrapper-before-de.patch (rev 0)
+++ packages/pyside/trunk/debian/patches/1.1.2-3-Use-QObject-property-to-invalidate-wrapper-before-de.patch 2013-06-13 05:18:48 UTC (rev 24778)
@@ -0,0 +1,111 @@
+From b3669dca4e4321b204d10b06018d35900b1847ee Mon Sep 17 00:00:00 2001
+From: John Ehresman <jpe at wingware.com>
+Date: Thu, 20 Dec 2012 17:26:29 -0500
+Subject: [PATCH 3/9] Use QObject property to invalidate wrapper before deletion.
+
+Define a getWrapperForQObject function to create / find
+wrappers for QObject derived objects. It sets a property
+so that an invalidate function can be called when the QObject
+property is cleared in the QObject destructor after all destroyed
+signal handlers have been called. Requires a change to shiboken
+to generate calls to the getWrapperForQObject function.
+
+Change-Id: I4ed548af114bf7176e8e8255a3ea70549c35d74c
+Reviewed-by: Hugo Parente Lima <hugo.lima at openbossa.org>
+---
+ libpyside/pyside.cpp | 52 ++++++++++++++++++++++++++++++++++++++++++++++++++
+ libpyside/pyside.h | 2 +
+ 2 files changed, 54 insertions(+), 0 deletions(-)
+
+diff --git a/libpyside/pyside.cpp b/libpyside/pyside.cpp
+index 0d96f95..a71b139 100644
+--- a/libpyside/pyside.cpp
++++ b/libpyside/pyside.cpp
+@@ -36,6 +36,7 @@
+ #include <basewrapper.h>
+ #include <conversions.h>
+ #include <sbkconverter.h>
++#include <gilstate.h>
+ #include <typeresolver.h>
+ #include <bindingmanager.h>
+ #include <algorithm>
+@@ -44,6 +45,7 @@
+ #include <QStack>
+ #include <QCoreApplication>
+ #include <QDebug>
++#include <QSharedPointer>
+
+ static QStack<PySide::CleanupFunction> cleanupFunctionList;
+ static void* qobjectNextAddr;
+@@ -293,5 +295,55 @@ void setNextQObjectMemoryAddr(void* addr)
+ qobjectNextAddr = addr;
+ }
+
++} // namespace PySide
++
++// A QSharedPointer is used with a deletion function to invalidate a pointer
++// when the property value is cleared. This should be a QSharedPointer with
++// a void* pointer, but that isn't allowed
++typedef char any_t;
++Q_DECLARE_METATYPE(QSharedPointer<any_t>);
++
++namespace PySide
++{
++
++static void invalidatePtr(any_t* object)
++{
++ Shiboken::GilState state;
++
++ SbkObject* wrapper = Shiboken::BindingManager::instance().retrieveWrapper(object);
++ if (wrapper != NULL)
++ Shiboken::BindingManager::instance().releaseWrapper(wrapper);
++}
++
++static const char invalidatePropertyName[] = "_PySideInvalidatePtr";
++
++PyObject* getWrapperForQObject(QObject* cppSelf, SbkObjectType* sbk_type)
++{
++ PyObject* pyOut = (PyObject*)Shiboken::BindingManager::instance().retrieveWrapper(cppSelf);
++ if (pyOut) {
++ Py_INCREF(pyOut);
++ return pyOut;
++ }
++
++ // Setting the property will trigger an QEvent notification, which may call into
++ // code that creates the wrapper so only set the property if it isn't already
++ // set and check if it's created after the set call
++ QVariant existing = cppSelf->property(invalidatePropertyName);
++ if (!existing.isValid()) {
++ QSharedPointer<any_t> shared_with_del((any_t*)cppSelf, invalidatePtr);
++ cppSelf->setProperty(invalidatePropertyName, QVariant::fromValue(shared_with_del));
++ pyOut = (PyObject*)Shiboken::BindingManager::instance().retrieveWrapper(cppSelf);
++ if (pyOut) {
++ Py_INCREF(pyOut);
++ return pyOut;
++ }
++ }
++
++ const char* typeName = typeid(*cppSelf).name();
++ pyOut = Shiboken::Object::newObject(sbk_type, cppSelf, false, false, typeName);
++
++ return pyOut;
++}
++
+ } //namespace PySide
+
+diff --git a/libpyside/pyside.h b/libpyside/pyside.h
+index 779c630..35cd364 100644
+--- a/libpyside/pyside.h
++++ b/libpyside/pyside.h
+@@ -117,6 +117,8 @@ PYSIDE_API bool inherits(PyTypeObject* self, const char* class_name);
+ PYSIDE_API void* nextQObjectMemoryAddr();
+ PYSIDE_API void setNextQObjectMemoryAddr(void* addr);
+
++PYSIDE_API PyObject* getWrapperForQObject(QObject* cppSelf, SbkObjectType* sbk_type);
++
+ } //namespace PySide
+
+
+--
+1.7.2.5
+
Modified: packages/pyside/trunk/debian/patches/series
===================================================================
--- packages/pyside/trunk/debian/patches/series 2013-06-13 05:18:31 UTC (rev 24777)
+++ packages/pyside/trunk/debian/patches/series 2013-06-13 05:18:48 UTC (rev 24778)
@@ -1,2 +1,5 @@
+1.1.2-1-Fix-reference-leak-on-convertion-from-a-C-map-type-t.patch
+1.1.2-2-Invalidate-metaObject-wrapper-before-deletion.patch
+1.1.2-3-Use-QObject-property-to-invalidate-wrapper-before-de.patch
lessBuildVerbosity.patch
cmake_selectDefaultPython.patch
More information about the Python-modules-commits
mailing list