Don't go into an infinite loop if there are absolutely no enabled

2001-07-27  Richard Hestilow  <hestilow@ximian.com>

	* prefs-widget.c (random_timeout_cb): Don't go into an infinite
	loop if there are absolutely no enabled screensavers.
This commit is contained in:
Richard Hestilow 2001-07-27 18:21:44 +00:00 committed by Rachel Hestilow
parent d063bb65b0
commit 2d9be3eb4e
2 changed files with 14 additions and 3 deletions

View file

@ -1,3 +1,8 @@
2001-07-27 Richard Hestilow <hestilow@ximian.com>
* prefs-widget.c (random_timeout_cb): Don't go into an infinite
loop if there are absolutely no enabled screensavers.
2001-07-27 Bradford Hovinen <hovinen@ximian.com>
* RELEASE : 1.5.2

View file

@ -702,7 +702,7 @@ selection_foreach_func (int model_row, int *closure)
static gint
random_timeout_cb (PrefsWidget *prefs_widget)
{
GList *l;
GList *l, *old;
g_return_val_if_fail (prefs_widget != NULL, FALSE);
@ -729,12 +729,18 @@ random_timeout_cb (PrefsWidget *prefs_widget)
if (!l)
l = prefs_widget->screensavers;
}
if (l)
old = l->next;
else
old = NULL;
while (l)
{
/* Are we back to where we started? */
if (((Screensaver*) l->data)->enabled
|| l == prefs_widget->priv->random_current)
|| l == prefs_widget->priv->random_current
|| (old && old == l))
break;
l = l->next;