fix a crash when there aren't any ALSA mixers (or soundcards) present on
2004-07-16 Bastien Nocera <hadess@hadess.net> * actions/acme-volume-alsa.c: (acme_volume_alsa_finalize), (acme_volume_alsa_close_real), (acme_volume_alsa_open), (acme_volume_alsa_init): fix a crash when there aren't any ALSA mixers (or soundcards) present on the system
This commit is contained in:
parent
daa9f3a0f6
commit
3a7566628f
2 changed files with 20 additions and 9 deletions
|
@ -1,3 +1,10 @@
|
|||
2004-07-16 Bastien Nocera <hadess@hadess.net>
|
||||
|
||||
* actions/acme-volume-alsa.c: (acme_volume_alsa_finalize),
|
||||
(acme_volume_alsa_close_real), (acme_volume_alsa_open),
|
||||
(acme_volume_alsa_init): fix a crash when there aren't any ALSA mixers
|
||||
(or soundcards) present on the system
|
||||
|
||||
2004-07-15 Bastien Nocera <hadess@hadess.net>
|
||||
|
||||
* actions/acme-volume-oss.c: fix OSS compilation on NetBSD
|
||||
|
|
|
@ -63,9 +63,6 @@ acme_volume_alsa_finalize (GObject *object)
|
|||
{
|
||||
AcmeVolumeAlsa *self;
|
||||
|
||||
g_return_if_fail (object != NULL);
|
||||
g_return_if_fail (ACME_IS_VOLUME_ALSA (object));
|
||||
|
||||
self = ACME_VOLUME_ALSA (object);
|
||||
|
||||
if (self->_priv)
|
||||
|
@ -78,6 +75,7 @@ acme_volume_alsa_finalize (GObject *object)
|
|||
|
||||
acme_volume_alsa_close_real (self);
|
||||
g_free (self->_priv);
|
||||
self->_priv = NULL;
|
||||
}
|
||||
|
||||
G_OBJECT_CLASS (parent_class)->finalize (object);
|
||||
|
@ -185,6 +183,9 @@ acme_volume_alsa_set_volume (AcmeVolume *vol, int val)
|
|||
static gboolean
|
||||
acme_volume_alsa_close_real (AcmeVolumeAlsa *self)
|
||||
{
|
||||
if (self->_priv == NULL)
|
||||
return FALSE;
|
||||
|
||||
if (self->_priv->handle != NULL)
|
||||
{
|
||||
snd_mixer_detach (self->_priv->handle, DEFAULT_CARD);
|
||||
|
@ -268,7 +269,7 @@ acme_volume_alsa_open (AcmeVolumeAlsa *self)
|
|||
return TRUE;
|
||||
|
||||
bail:
|
||||
acme_volume_alsa_close (self);
|
||||
acme_volume_alsa_close_real (self);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
@ -284,14 +285,17 @@ acme_volume_alsa_init (AcmeVolumeAlsa *self)
|
|||
{
|
||||
self->_priv = g_new0 (AcmeVolumeAlsaPrivate, 1);
|
||||
|
||||
acme_volume_alsa_open (self);
|
||||
if (self->_priv->handle != NULL) {
|
||||
acme_volume_alsa_close (self);
|
||||
if (acme_volume_alsa_open (self) == FALSE)
|
||||
{
|
||||
g_free (self->_priv);
|
||||
self->_priv = NULL;
|
||||
return;
|
||||
}
|
||||
|
||||
g_free (self->_priv);
|
||||
self->_priv = NULL;
|
||||
if (self->_priv->handle != NULL) {
|
||||
acme_volume_alsa_close_real (self);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue