Bug 25052

Summary: WockyTestStream should error on dispose if streams aren't closed
Product: Wocky Reporter: Dafydd Harries <dafydd.harries>
Component: GeneralAssignee: Sjoerd Simons <sjoerd>
Status: NEW --- QA Contact:
Severity: normal    
Priority: medium    
Version: unspecified   
Hardware: Other   
OS: All   
Whiteboard:
i915 platform: i915 features:

Description Dafydd Harries 2009-11-12 08:40:41 UTC
If a child stream is still open at the point that a test stream is disposed, it probably means the tests are doing something wrong, and can lead to hard-to-diagnose memory leaks.

Here's a naïve patch. It seems to make most of the tests fail at this point though.

diff --git a/tests/wocky-test-stream.c b/tests/wocky-test-stream.c
index fbc52c5..93b4fcf 100644
--- a/tests/wocky-test-stream.c
+++ b/tests/wocky-test-stream.c
@@ -168,6 +168,15 @@ wocky_test_stream_dispose (GObject *object)
 
   self->priv->dispose_has_run = TRUE;
 
+  g_assert (g_input_stream_is_closed (
+        WOCKY_TEST_IO_STREAM (self->stream0)->input));
+  g_assert (g_output_stream_is_closed (
+        WOCKY_TEST_IO_STREAM (self->stream0)->output));
+  g_assert (g_input_stream_is_closed (
+        WOCKY_TEST_IO_STREAM (self->stream1)->input));
+  g_assert (g_output_stream_is_closed (
+        WOCKY_TEST_IO_STREAM (self->stream1)->output));
+
   g_object_unref (self->stream0);
   self->stream0 = NULL;

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.