bc54b6f8fb0bddf703569f0099faf378ee37b090
diff --git a/gtk/gtkmain.c b/gtk/gtkmain.c
index d5e9fc2..111cb28 100644
--- a/gtk/gtkmain.c
+++ b/gtk/gtkmain.c
@@ -61,6 +61,7 @@
 #include "gtkmain.h"
 #include "gtkmodules.h"
 #include "gtkrc.h"
+#include "gtkrecentmanager.h"
 #include "gtkselection.h"
 #include "gtksettings.h"
 #include "gtkwidget.h"
@@ -1187,9 +1188,14 @@ gtk_main (void)
 
   gtk_main_loop_level--;
 
-  /* Try storing all clipboard data we have */
   if (gtk_main_loop_level == 0)
-    _gtk_clipboard_store_all ();
+    {
+      /* Try storing all clipboard data we have */
+      _gtk_clipboard_store_all ();
+
+      /* Synchronize and unref the recent manager singleton */
+      _gtk_recent_manager_sync_and_remove ();
+    }
 }
 
 guint
