diff --git a/gio/glocalfile.c b/gio/glocalfile.c
index 4641f2e..977b78c 100644
--- a/gio/glocalfile.c
+++ b/gio/glocalfile.c
@@ -1788,6 +1788,7 @@ g_local_file_trash (GFile         *file,
   GLocalFile *local = G_LOCAL_FILE (file);
   GStatBuf file_stat, home_stat;
   const char *homedir;
+  GFile* homedir_file;
   char *trashdir, *topdir, *infodir, *filesdir;
   char *basename, *trashname, *trashfile, *infoname, *infofile;
   char *original_name, *original_name_escaped;
@@ -1814,11 +1815,13 @@ g_local_file_trash (GFile         *file,
     
   homedir = g_get_home_dir ();
   g_stat (homedir, &home_stat);
+  homedir_file = g_file_new_for_path(homedir);
 
   is_homedir_trash = FALSE;
   trashdir = NULL;
-  if (file_stat.st_dev == home_stat.st_dev)
+  if (file_stat.st_dev == home_stat.st_dev && g_file_has_prefix(file, homedir_file))
     {
+      g_object_unref(homedir_file);
       is_homedir_trash = TRUE;
       errno = 0;
       trashdir = g_build_filename (g_get_user_data_dir (), "Trash", NULL);
