diff options
author | John Ehresman <jpe@wingware.com> | 2013-06-16 18:10:53 -0400 |
---|---|---|
committer | John Cummings <jcummings2@users.sf.net> | 2013-06-24 18:03:20 +0200 |
commit | 79e32dd6c67cfbd0d0e2b163e6d1959ea5161465 (patch) | |
tree | 9a15a6092649732da54cfe9e4764a04824df699a /tests/samplebinding | |
parent | f060e1ce92fdb4714ca2cface9474db33f1d8e95 (diff) |
Fix segfault when using shiboken.delete
When an object is deleted, invalidate / releaseWrapper needs to
be called before cptr array is deleted.
Change-Id: I82f71f569d5a0f52084fbe1cc3d7846e764c7ef6
Reviewed-by: John Cummings <jcummings2@users.sf.net>
Diffstat (limited to 'tests/samplebinding')
-rw-r--r-- | tests/samplebinding/delete_test.py | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/tests/samplebinding/delete_test.py b/tests/samplebinding/delete_test.py new file mode 100644 index 000000000..4448025f3 --- /dev/null +++ b/tests/samplebinding/delete_test.py @@ -0,0 +1,42 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# This file is part of the Shiboken Python Bindings Generator project. +# +# Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +# +# Contact: PySide team <contact@pyside.org> +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public License +# version 2.1 as published by the Free Software Foundation. Please +# review the following information to ensure the GNU Lesser General +# Public License version 2.1 requirements will be met: +# http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +# # +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA +# 02110-1301 USA + +import unittest +import sample +import shiboken + +class DeleteTest(unittest.TestCase): + def testNonCppWrapperClassDelete(self): + """Would segfault when shiboken.delete called on obj not created from + Python """ + obj = sample.ObjectType() + child = obj.createChild(None) + shiboken.delete(child) + assert not shiboken.isValid(child) + +if __name__ == '__main__': + unittest.main() + |