summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorChristoph Reiter <reiter.christoph@gmail.com>2019-01-18 11:22:26 +0100
committerChristoph Reiter <reiter.christoph@gmail.com>2019-01-18 11:25:39 +0100
commit27293ec8f7e9c11ed609afc1bf3e87cc602739cb (patch)
tree24a25839eaa2378a2a1529776212b12ec55f727e /tests
parentf122922276bfee0c01141c1ce6690d11399f6f1a (diff)
downloadpygobject-27293ec8f7e9c11ed609afc1bf3e87cc602739cb.tar.gz
gio overrides: emit a warning when creating various dbus types without a constructor. Fixes #15
We zero slice allocate them and the boxed copy/free functions don't handle that. They just use ref counting which leads to double free because we start with a zero refcount and the free funcs use g_free() while we allocate it with g_slice_alloc().
Diffstat (limited to 'tests')
-rw-r--r--tests/test_overrides_gio.py15
1 files changed, 15 insertions, 0 deletions
diff --git a/tests/test_overrides_gio.py b/tests/test_overrides_gio.py
index b6516f9b..8612d51e 100644
--- a/tests/test_overrides_gio.py
+++ b/tests/test_overrides_gio.py
@@ -2,10 +2,12 @@ from __future__ import absolute_import
import random
import platform
+import warnings
import pytest
from gi.repository import Gio, GObject
+from gi import PyGIWarning
from gi._compat import cmp
@@ -344,3 +346,16 @@ def test_action_map_add_action_entries():
actionmap.activate_action("simple")
assert test_data[0] == 'test back'
+
+
+def test_types_init_warn():
+ types = [
+ Gio.DBusAnnotationInfo, Gio.DBusArgInfo, Gio.DBusMethodInfo,
+ Gio.DBusSignalInfo, Gio.DBusInterfaceInfo, Gio.DBusNodeInfo,
+ ]
+
+ for t in types:
+ with warnings.catch_warnings(record=True) as warn:
+ warnings.simplefilter('always')
+ t()
+ assert issubclass(warn[0].category, PyGIWarning)