[gedit] document-loader test: delete the document after the document runs disposal



commit c8c49a72741095f3b3fdff8dab601c36224a3d39
Author: Ignacio Casal Quinteiro <icq gnome org>
Date:   Fri Jan 10 23:40:04 2014 +0100

    document-loader test: delete the document after the document runs disposal
    
    The document sets metadata on the disposal, if we delete the file
    under its feet then we will get a warning about not able to set the
    metadata.

 tests/document-loader.c |   10 ++++------
 1 files changed, 4 insertions(+), 6 deletions(-)
---
diff --git a/tests/document-loader.c b/tests/document-loader.c
index ee01653..3f1d32d 100644
--- a/tests/document-loader.c
+++ b/tests/document-loader.c
@@ -32,7 +32,6 @@ typedef struct
 {
        const gchar   *in_buffer;
        gint           newline_type;
-       GFile         *file;
 } LoaderTestData;
 
 static GFile *
@@ -59,8 +58,6 @@ delete_document (GFile *location)
                g_file_delete (location, NULL, &err);
                g_assert_no_error (err);
        }
-
-       test_completed = TRUE;
 }
 
 static void
@@ -91,7 +88,7 @@ on_document_loaded (GeditDocument  *document,
                                 data->newline_type);
        }
 
-       delete_document (data->file);
+       test_completed = TRUE;
 }
 
 static void
@@ -110,7 +107,6 @@ test_loader (const gchar *filename,
        LoaderTestData *data = g_slice_new (LoaderTestData);
        data->in_buffer = in_buffer;
        data->newline_type = newline_type;
-       data->file = file;
 
        test_completed = FALSE;
 
@@ -127,8 +123,10 @@ test_loader (const gchar *filename,
        }
 
        g_slice_free (LoaderTestData, data);
-       g_object_unref (file);
        g_object_unref (document);
+
+       delete_document (file);
+       g_object_unref (file);
 }
 
 static void


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]