summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichal Ratajsky <[email protected]>2016-01-07 14:27:47 +0100
committerraveit65 <[email protected]>2017-02-21 11:55:59 +0100
commit83c153286395c02433a7273f42e11ccbfa77d79e (patch)
tree1146219b8ee0fc03dcab75a8ababa15740ba0c20
parent9b4dc2717f267882b3625ef36218e2d6e715fd5d (diff)
downloadlibmatemixer-83c153286395c02433a7273f42e11ccbfa77d79e.tar.bz2
libmatemixer-83c153286395c02433a7273f42e11ccbfa77d79e.tar.xz
oss: Prevent streams from being gettable at the time they are removed
-rw-r--r--backends/oss/oss-device.c18
1 files changed, 14 insertions, 4 deletions
diff --git a/backends/oss/oss-device.c b/backends/oss/oss-device.c
index 71af6c6..dc60ebf 100644
--- a/backends/oss/oss-device.c
+++ b/backends/oss/oss-device.c
@@ -355,6 +355,8 @@ oss_device_is_open (OssDevice *device)
void
oss_device_close (OssDevice *device)
{
+ OssStream *stream;
+
g_return_if_fail (OSS_IS_DEVICE (device));
if (device->priv->fd == -1)
@@ -365,22 +367,30 @@ oss_device_close (OssDevice *device)
oss_stream_remove_all (device->priv->input);
free_stream_list (device);
+ stream = device->priv->input;
+
+ /* Makes the stream getter return NULL when the signal is emitted */
+ device->priv->input = NULL;
g_signal_emit_by_name (G_OBJECT (device),
"stream-removed",
- MATE_MIXER_STREAM (device->priv->input));
+ MATE_MIXER_STREAM (stream));
- g_clear_object (&device->priv->input);
+ g_object_unref (stream);
}
if (device->priv->output != NULL) {
oss_stream_remove_all (device->priv->output);
free_stream_list (device);
+ stream = device->priv->output;
+
+ /* Makes the stream getter return NULL when the signal is emitted */
+ device->priv->output = NULL;
g_signal_emit_by_name (G_OBJECT (device),
"stream-removed",
- MATE_MIXER_STREAM (device->priv->output));
+ MATE_MIXER_STREAM (stream));
- g_clear_object (&device->priv->output);
+ g_object_unref (stream);
}
if (device->priv->poll_tag != 0)