}
 }
 
+#ifdef PLY_ENABLE_GDM_TRANSITION
+static void
+tell_gdm_to_transition (void)
+{
+  int fd;
+
+  fd = creat ("/var/spool/gdm/force-display-on-active-vt", 0644);
+  close (fd);
+}
+#endif
+
 static void
 on_quit (state_t *state,
          bool     retain_splash)
     }
   ply_trace ("exiting event loop");
   ply_event_loop_exit (state->loop, 0);
+
+  tell_gdm_to_transition ();
 }
 
 static ply_boot_server_t *
 
   return plugin;
 }
 
-#ifdef PLY_ENABLE_GDM_TRANSITION
-static void
-tell_gdm_to_transition (void)
-{
-  int fd;
-
-  fd = creat ("/var/spool/gdm/force-display-on-active-vt", 0644);
-  close (fd);
-}
-#endif
-
 void
 destroy_plugin (ply_boot_splash_plugin_t *plugin)
 {
   ply_label_free (plugin->label);
   ply_list_free (plugin->sprites);
 
-#ifdef PLY_ENABLE_GDM_TRANSITION
-  if (plugin->is_visible)
-    tell_gdm_to_transition ();
-#endif
-
   free (plugin);
 }
 
 
   return plugin;
 }
 
-#ifdef PLY_ENABLE_GDM_TRANSITION
-static void
-tell_gdm_to_transition (void)
-{
-  int fd;
-
-  fd = creat ("/var/spool/gdm/force-display-on-active-vt", 0644);
-  close (fd);
-}
-#endif
-
 void
 destroy_plugin (ply_boot_splash_plugin_t *plugin)
 {
   ply_label_free (plugin->label);
   ply_progress_bar_free (plugin->progress_bar);
 
-#ifdef PLY_ENABLE_GDM_TRANSITION
-  if (plugin->is_visible)
-    tell_gdm_to_transition ();
-#endif
-
   free (plugin);
 }