[gtk+/gtk-2-24] filechooserbutton: Duh, remove all the timeouts after tests
- From: Federico Mena Quintero <federico src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/gtk-2-24] filechooserbutton: Duh, remove all the timeouts after tests
- Date: Wed, 13 Mar 2013 02:23:42 +0000 (UTC)
commit e11b1943c7f728c6fdf5ef483db8f9f1d05b4306
Author: Federico Mena Quintero <federico gnome org>
Date: Tue Mar 12 13:34:13 2013 -0600
filechooserbutton: Duh, remove all the timeouts after tests
Otherwise tests may start failing if they start after an old timeout triggers.
Signed-off-by: Federico Mena Quintero <federico gnome org>
gtk/tests/filechooser.c | 20 ++++++++++++++++----
1 files changed, 16 insertions(+), 4 deletions(-)
---
diff --git a/gtk/tests/filechooser.c b/gtk/tests/filechooser.c
index 994be9d..7db7ce5 100644
--- a/gtk/tests/filechooser.c
+++ b/gtk/tests/filechooser.c
@@ -128,6 +128,7 @@ test_set_filename (GtkFileChooserAction action,
{
GtkWidget *chooser;
struct test_set_filename_closure closure;
+ guint timeout_id;
chooser = gtk_file_chooser_dialog_new ("hello", NULL, action,
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
@@ -141,8 +142,9 @@ test_set_filename (GtkFileChooserAction action,
(* set_filename_fn) (GTK_FILE_CHOOSER (chooser), data);
- gdk_threads_add_timeout_full (G_MAXINT, SLEEP_DURATION, set_filename_timeout_cb, &closure, NULL);
+ timeout_id = gdk_threads_add_timeout_full (G_MAXINT, SLEEP_DURATION, set_filename_timeout_cb, &closure,
NULL);
gtk_dialog_run (GTK_DIALOG (chooser));
+ g_source_remove (timeout_id);
(* compare_filename_fn) (GTK_FILE_CHOOSER (chooser), data);
@@ -373,8 +375,11 @@ sleep_timeout_cb (gpointer data)
static void
sleep_in_main_loop (void)
{
- gdk_threads_add_timeout_full (G_MAXINT, 250, sleep_timeout_cb, NULL, NULL);
+ guint timeout_id;
+
+ timeout_id = gdk_threads_add_timeout_full (G_MAXINT, 250, sleep_timeout_cb, NULL, NULL);
gtk_main ();
+ g_source_remove (timeout_id);
}
static void
@@ -607,10 +612,15 @@ signal_watcher_expect (SignalWatcher *watcher, const char *signal_name, char *un
if (!conn->emitted)
{
- gdk_threads_add_timeout_full (G_MAXINT, 1000, sleep_timeout_cb, NULL, NULL);
+ guint timeout_id;
+
+ timeout_id = gdk_threads_add_timeout_full (G_MAXINT, 1000, sleep_timeout_cb, NULL, NULL);
+
watcher->in_main_loop = TRUE;
gtk_main ();
watcher->in_main_loop = FALSE;
+
+ g_source_remove (timeout_id);
}
emitted = conn->emitted;
@@ -1780,6 +1790,7 @@ test_confirm_overwrite_for_path (const char *path, gboolean append_extension)
gboolean passed;
struct confirm_overwrite_closure closure;
char *filename;
+ guint timeout_id;
passed = TRUE;
@@ -1825,8 +1836,9 @@ test_confirm_overwrite_for_path (const char *path, gboolean append_extension)
gtk_file_chooser_set_filename (GTK_FILE_CHOOSER (closure.chooser), path);
}
- gdk_threads_add_timeout_full (G_MAXINT, SLEEP_DURATION, confirm_overwrite_timeout_cb, &closure, NULL);
+ timeout_id = gdk_threads_add_timeout_full (G_MAXINT, SLEEP_DURATION, confirm_overwrite_timeout_cb,
&closure, NULL);
gtk_dialog_run (GTK_DIALOG (closure.chooser));
+ g_source_remove (timeout_id);
filename = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (closure.chooser));
passed = passed && filename && (strcmp (filename, path) == 0);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]