Bug 25052 - WockyTestStream should error on dispose if streams aren't closed
Summary: WockyTestStream should error on dispose if streams aren't closed
Status: NEW
Alias: None
Product: Wocky
Classification: Unclassified
Component: General (show other bugs)
Version: unspecified
Hardware: Other All
: medium normal
Assignee: Sjoerd Simons
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-11-12 08:40 UTC by Dafydd Harries
Modified: 2009-11-12 08:40 UTC (History)
0 users

See Also:
i915 platform:
i915 features:


Attachments

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.