diff --git a/includes/menu.inc b/includes/menu.inc
index 1fe5a64..79282be 100644
--- a/includes/menu.inc
+++ b/includes/menu.inc
@@ -2880,9 +2880,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'];
     }
   }
@@ -2958,10 +2960,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/modules/simpletest/tests/menu.test b/modules/simpletest/tests/menu.test
index f5d7d29..78e1a7e 100644
--- a/modules/simpletest/tests/menu.test
+++ b/modules/simpletest/tests/menu.test
@@ -1738,3 +1738,34 @@ class MenuTrailTestCase extends MenuWebTestCase {
     }
   }
 }
+
+/**
+ * Tests menu changes.
+ */
+class MenuChangeTestCase extends MenuWebTestCase {
+  public static function getInfo() {
+    return array(
+      'name' => 'Menu changes',
+      'description' => 'Tests that menu links are 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/modules/simpletest/tests/menu_test.module b/modules/simpletest/tests/menu_test.module
index 0b954ae..d917107 100644
--- a/modules/simpletest/tests/menu_test.module
+++ b/modules/simpletest/tests/menu_test.module
@@ -561,3 +561,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;
+}
