Index: memcache_admin/memcache_admin.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/memcache/memcache_admin/memcache_admin.module,v
retrieving revision 1.3.2.10.2.6
diff -u -p -r1.3.2.10.2.6 memcache_admin.module
--- memcache_admin/memcache_admin.module	18 Oct 2010 22:23:20 -0000	1.3.2.10.2.6
+++ memcache_admin/memcache_admin.module	19 Oct 2010 09:28:58 -0000
@@ -223,6 +223,14 @@ function _memcache_admin_get_bin_for_clu
 function memcache_admin_shutdown() {
   global $_memcache_statistics;
 
+  // Don't call theme() during shutdown if the registry has been rebuilt (such
+  // as when enabling/disabling modules on admin/build/modules) as things break.
+  // Instead, simply exit without displaying admin statistics for this page
+  // load.  See http://drupal.org/node/616282 for discussion.
+  if (!function_exists('theme_get_registry') || !theme_get_registry()) {
+    return;
+  }
+
   // Try not to break non-HTML pages.
   if (function_exists('drupal_get_headers')) {
     $headers = drupal_get_headers();
