Index: modules/overlay/overlay.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/overlay/overlay.module,v
retrieving revision 1.12
diff -u -p -r1.12 overlay.module
--- modules/overlay/overlay.module	9 Mar 2010 22:23:59 -0000	1.12
+++ modules/overlay/overlay.module	16 Mar 2010 13:31:25 -0000
@@ -56,9 +56,13 @@ function overlay_permission() {
 function overlay_init() {
   // @todo: custom_theme does not exist anymore.
   global $custom_theme;
-  // Only act if the user has access to administration pages. Other modules can
-  // also enable the overlay directly for other uses of the JavaScript.
-  if (user_access('access overlay')) {
+  
+  $mode = overlay_get_mode();
+
+  // Only act if the user has access to the overlay and an mode was not
+  // already set. Other modules can also enable the overlay directly for 
+  // other uses.
+  if (empty($mode) && user_access('access overlay')) {
     // After overlay is enabled on the modules page, redirect to
     // <front>#overlay=admin/modules to actually enable the overlay.
     if (isset($_SESSION['overlay_enable_redirect']) && $_SESSION['overlay_enable_redirect']) {
