Index: modules/overlay/overlay-child.js
===================================================================
RCS file: /cvs/drupal/drupal/modules/overlay/overlay-child.js,v
retrieving revision 1.6
diff -u -r1.6 overlay-child.js
--- modules/overlay/overlay-child.js	9 Mar 2010 20:52:27 -0000	1.6
+++ modules/overlay/overlay-child.js	3 Apr 2010 11:53:34 -0000
@@ -37,7 +37,7 @@
         // We need to store the parent variable locally because it will
         // disappear as soon as we close the iframe.
         var p = parent;
-        p.Drupal.overlay.close(settings.args, settings.statusMessages);
+        p.Drupal.overlay.close();
         if (typeof settings.redirect == 'string') {
           p.Drupal.overlay.redirect(settings.redirect);
         }
Index: modules/overlay/overlay.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/overlay/overlay.module,v
retrieving revision 1.14
diff -u -r1.14 overlay.module
--- modules/overlay/overlay.module	26 Mar 2010 18:58:12 -0000	1.14
+++ modules/overlay/overlay.module	3 Apr 2010 11:53:34 -0000
@@ -59,17 +59,18 @@
   // 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')) {
+    $current_path = current_path();
     // 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']) {
       unset($_SESSION['overlay_enable_redirect']);
-      drupal_goto('<front>', array('fragment' => 'overlay=' . current_path()));
+      drupal_goto('<front>', array('fragment' => 'overlay=' . $current_path));
     }
 
     if (isset($_GET['render']) && $_GET['render'] == 'overlay') {
       // If this page shouldn't be rendered here, redirect to the parent.
-      if (!path_is_admin($_GET['q'])) {
-        overlay_close_dialog();
+      if (!path_is_admin($current_path)) {
+        overlay_close_dialog($current_path);
       }
       // If system module did not switch the theme yet (i.e. this is not an
       // admin page, per se), we should switch the theme here.
@@ -85,7 +86,7 @@
       unset($_GET['render']);
     }
     // Do not enable the overlay if we already are on an admin page.
-    else if (!path_is_admin(current_path())) {
+    else if (!path_is_admin($current_path)) {
       // Otherwise add overlay parent code and our behavior.
       overlay_set_mode('parent');
     }
@@ -348,14 +349,9 @@
  * @ingroup forms
  */
 function overlay_form_submit($form, &$form_state) {
-  $settings = &drupal_static(__FUNCTION__);
-
-  // Check if we have a request to close the overlay.
-  $args = overlay_request_dialog_close();
-
   // Close the overlay if the overlay module has been disabled
   if (!module_exists('overlay')) {
-    $args = overlay_request_dialog_close(TRUE);
+    overlay_request_dialog_close(TRUE);
   }
 
   // If there is a form redirect to a non-admin page, close the overlay.
@@ -374,26 +370,13 @@
       $url_settings = array();
     }
     if (!path_is_admin($url)) {
-      $args = overlay_request_dialog_close(TRUE);
+      overlay_request_dialog_close(TRUE);
     }
   }
 
   // If the overlay is to be closed, pass that information through JavaScript.
-  if ($args !== FALSE) {
-    if (!isset($settings)) {
-      $settings = array(
-        'overlayChild' => array(
-          'closeOverlay' => TRUE,
-          'statusMessages' => theme('status_messages'),
-          'args' => $args,
-        ),
-      );
-      // Tell the child window to perform the redirection when requested to.
-      if (!empty($form_state['redirect'])) {
-        $settings['overlayChild']['redirect'] = url($url, $settings);
-      }
-      drupal_add_js($settings, array('type' => 'setting'));
-    }
+  if (overlay_request_dialog_close() !== FALSE) {
+    overlay_close_dialog($url, $url_settings);
     // Tell FAPI to redraw the form without redirection after all submit
     // callbacks have been processed.
     $form_state['redirect'] = FALSE;
@@ -504,19 +487,18 @@
  * Callback to request that the overlay close on the next page load.
  *
  * @param $value
- *   By default, the dialog will not close. Set to TRUE or a value evaluating to
- *   TRUE to request the dialog to close. Use FALSE to disable closing the
- *   dialog (if it was previously enabled). The value passed will be forwarded
- *   to the onOverlayClose callback of the overlay.
+ *   By default, the dialog will not close. Set to TRUE to request the dialog to
+ *   close. Use FALSE to disable closing the dialog (if it was previously
+ *   enabled).
  *
  * @return
- *   The current overlay close dialog mode, a value evaluating to TRUE if the
+ *   The current overlay close dialog mode, TRUE if the
  *   overlay should close or FALSE if it should not (default).
  */
 function overlay_request_dialog_close($value = NULL) {
   $close = &drupal_static(__FUNCTION__, FALSE);
   if (isset($value)) {
-    $close = $value;
+    $close = $value == TRUE;
   }
   return $close;
 }
@@ -526,21 +508,22 @@
  *
  * @param $redirect
  *   The path that should open in the parent window after the overlay closes.
+ * @param $redirect_options
+ *   An associative array of options to use when generating the redirect URL.
  */
-function overlay_close_dialog($redirect = NULL) {
-  if (!isset($redirect)) {
-    $redirect = current_path();
-  }
+function overlay_close_dialog($redirect = NULL, $redirect_options = array()) {
   $settings = array(
     'overlayChild' => array(
       'closeOverlay' => TRUE,
-      'statusMessages' => theme('status_messages'),
-      'args' => $args,
-      'redirect' => url($redirect),
     ),
   );
+
+  // Tell the child window to perform the redirection when requested to.
+  if (!empty($redirect)) {
+    $settings['overlayChild']['redirect'] = url($redirect, $redirect_options);
+  }
+
   drupal_add_js($settings, array('type' => 'setting'));
-  return $settings;
 }
 
 /**
Index: modules/overlay/overlay-parent.js
===================================================================
RCS file: /cvs/drupal/drupal/modules/overlay/overlay-parent.js,v
retrieving revision 1.34
diff -u -r1.34 overlay-parent.js
--- modules/overlay/overlay-parent.js	27 Mar 2010 05:47:08 -0000	1.34
+++ modules/overlay/overlay-parent.js	3 Apr 2010 11:53:34 -0000
@@ -39,9 +39,6 @@
   isClosing: false,
   isLoading: false,
 
-  onOverlayCloseArgs: null,
-  onOverlayCloseStatusMessages: null,
-
   resizeTimeoutID: null,
   lastHeight: 0,
 
@@ -220,10 +217,8 @@
     self.lastHeight = 0;
 
     if ($.isFunction(self.options.onOverlayClose)) {
-      self.options.onOverlayClose(self.onOverlayCloseArgs, self.onOverlayCloseStatusMessages);
+      self.options.onOverlayClose();
     }
-    self.onOverlayCloseArgs = null;
-    self.onOverlayCloseStatusMessages = null;
   };
 
   // Default jQuery UI Dialog options.
@@ -358,13 +353,8 @@
 /**
  * Close the overlay and remove markup related to it from the document.
  */
-Drupal.overlay.close = function (args, statusMessages) {
-  var self = this;
-
-  self.onOverlayCloseArgs = args;
-  self.onOverlayCloseStatusMessages = statusMessages;
-
-  return self.$container.dialog('close');
+Drupal.overlay.close = function () {
+  return this.$container.dialog('close');
 };
 
 /**
