| 1 |
From 72067bb5a6d92564284f5a6a94369f24cd4405bb Mon Sep 17 00:00:00 2001 |
| 2 |
From: Sean Vig <[email protected]> |
| 3 |
Date: Tue, 6 Sep 2016 22:38:14 -0700 |
| 4 |
Subject: Fix XCB tests |
| 5 |
|
| 6 |
Make sure XCB objects are free'd, and cffi objects set to None so they |
| 7 |
are gc'd and destroyed before the connection is disconnected. |
| 8 |
|
| 9 |
Origin: https://github.com/Kozea/cairocffi/pull/68 |
| 10 |
Bug-Debian: https://bugs.debian.org/828929 |
| 11 |
|
| 12 |
Patch-Name: fix-xcb-tests.patch |
| 13 |
--- |
| 14 |
cairocffi/test_xcb.py | 18 ++++++++++++++++-- |
| 15 |
1 file changed, 16 insertions(+), 2 deletions(-) |
| 16 |
|
| 17 |
diff --git a/cairocffi/test_xcb.py b/cairocffi/test_xcb.py |
| 18 |
index c8a6e70..1aa5123 100644 |
| 19 |
--- a/cairocffi/test_xcb.py |
| 20 |
+++ b/cairocffi/test_xcb.py |
| 21 |
@@ -87,6 +87,10 @@ def create_pixmap(conn, wid, width, height): |
| 22 |
return pixmap |
| 23 |
|
| 24 |
|
| 25 |
+def remove_pixmap(conn, pixmap): |
| 26 |
+ conn.core.FreePixmap(pixmap) |
| 27 |
+ |
| 28 |
+ |
| 29 |
def create_gc(conn): |
| 30 |
"""Creates a simple graphics context""" |
| 31 |
gc = conn.generate_id() |
| 32 |
@@ -104,8 +108,10 @@ def create_gc(conn): |
| 33 |
return gc |
| 34 |
|
| 35 |
|
| 36 |
[email protected](cairo_version() < 11200, |
| 37 |
- reason="Cairo version too low") |
| 38 |
+def remove_gc(conn, gc): |
| 39 |
+ conn.core.FreeGC(gc) |
| 40 |
+ |
| 41 |
+ |
| 42 |
def test_xcb_pixmap(xcb_conn): |
| 43 |
width = 10 |
| 44 |
height = 10 |
| 45 |
@@ -149,6 +155,11 @@ def test_xcb_pixmap(xcb_conn): |
| 46 |
width, height |
| 47 |
) |
| 48 |
|
| 49 |
+ ctx = None |
| 50 |
+ surface = None |
| 51 |
+ remove_gc(xcb_conn, gc) |
| 52 |
+ remove_pixmap(xcb_conn, pixmap) |
| 53 |
+ |
| 54 |
# flush the connection, make sure no errors were thrown |
| 55 |
xcb_conn.flush() |
| 56 |
while event: |
| 57 |
@@ -220,6 +231,9 @@ def test_xcb_window(xcb_conn): |
| 58 |
ctx.set_source_rgb(1, 1, 1) |
| 59 |
ctx.paint() |
| 60 |
|
| 61 |
+ ctx = None |
| 62 |
+ surface = None |
| 63 |
+ |
| 64 |
# flush the connection, make sure no errors were thrown |
| 65 |
xcb_conn.flush() |
| 66 |
while event: |