diff --git a/core/includes/menu.inc b/core/includes/menu.inc
index 0ab3d8c..932681b 100644
--- a/core/includes/menu.inc
+++ b/core/includes/menu.inc
@@ -2750,9 +2750,11 @@ function _menu_link_build($item) {
 function _menu_navigation_links_rebuild($menu) {
   // Add normal and suggested items as links.
   $menu_links = array();
+  $default_menu_link_paths = array();
   foreach ($menu as $path => $item) {
     if ($item['_visible']) {
       $menu_links[$path] = $item;
+      $default_menu_link_paths[] = $path;
       $sort[$path] = $item['_number_parts'];
     }
   }
@@ -2828,10 +2830,10 @@ function _menu_navigation_links_rebuild($menu) {
         ->execute();
     }
   }
-  // Find any item whose router path does not exist any more.
+  // Find any item whose router path does not exist or is no longer visible.
   $result = db_select('menu_links')
     ->fields('menu_links')
-    ->condition('router_path', $paths, 'NOT IN')
+    ->condition('router_path', $default_menu_link_paths, 'NOT IN')
     ->condition('external', 0)
     ->condition('updated', 0)
     ->condition('customized', 0)
diff --git a/core/modules/simpletest/tests/menu.test b/core/modules/simpletest/tests/menu.test
index 5a173b1..55834b6 100644
--- a/core/modules/simpletest/tests/menu.test
+++ b/core/modules/simpletest/tests/menu.test
@@ -1619,3 +1619,34 @@ class MenuTrailTestCase extends MenuWebTestCase {
     $this->assertBreadcrumb('admin/config/development/menu-trail', $override_breadcrumb, t('Menu trail - Case 2'), $override_tree);
   }
 }
+
+/**
+ * Tests active menu trails.
+ */
+class MenuChangeTestCase extends MenuWebTestCase {
+  public static function getInfo() {
+    return array(
+      'name' => 'Menu changes',
+      'description' => 'Tests that menu links is updated on menu rebuild.',
+      'group' => 'Menu',
+    );
+  }
+
+  function setUp() {
+    parent::setUp('menu_test');
+  }
+
+  function testMenuChangeTypeTestCase() {
+    // Check that the test menu item exists.
+    $sql = "SELECT type FROM {menu_links}, {menu_router} WHERE {menu_links}.router_path = {menu_router}.path AND {menu_links}.router_path = 'menu-test/changes'";
+    $type = db_query($sql)->fetchField();
+    $this->assertEqual($type, MENU_NORMAL_ITEM, t('Menu item exists and is type MENU_NORMAL_ITEM.'));
+
+    // Change item type to MENU_CALLBACK and rebuild menu.
+    menu_test_change_menu_information(array('type' => MENU_CALLBACK));
+    menu_rebuild();
+
+    $result = db_query($sql)->rowCount();
+    $this->assertEqual($result, 0, t('Menu item no longer exists in menu_links table after menu_rebuild.'));
+  }
+}
diff --git a/core/modules/simpletest/tests/menu_test.module b/core/modules/simpletest/tests/menu_test.module
index c42aca6..a1ff49c 100644
--- a/core/modules/simpletest/tests/menu_test.module
+++ b/core/modules/simpletest/tests/menu_test.module
@@ -330,6 +330,13 @@ function menu_test_menu() {
     'page callback' => 'menu_test_callback',
     'access callback' => TRUE,
   );
+  // Menu changes information updates menu rebuild.
+  $items['menu-test/changes'] = menu_test_change_menu_information() + array(
+    'title' => 'Menu Test Changes Test',
+    'page callback' => 'menu_test_callback',
+    'access callback' => TRUE,
+    'type' => MENU_NORMAL_ITEM,
+  );
 
   return $items;
 }
@@ -525,3 +532,17 @@ function menu_login_callback() {
 function menu_test_title_callback($title, $case_no = 3) {
   return t($title) . ' - Case ' . $case_no;
 }
+
+/**
+ * Helper function for MenuChangeTestCase.
+ *
+ * @param $new_information
+ *   An array of information to override the 'menu-test/changes' defination.
+ */
+function menu_test_change_menu_information($new_information = NULL) {
+  static $information = array();
+  if (isset($new_information)) {
+    $information = $new_information;
+  }
+  return $information;
+}
