Index: modules/system/system.admin.inc
===================================================================
RCS file: /cvs/drupal/drupal/modules/system/system.admin.inc,v
retrieving revision 1.290
diff -u -p -r1.290 system.admin.inc
--- modules/system/system.admin.inc	26 Jun 2010 21:32:20 -0000	1.290
+++ modules/system/system.admin.inc	29 Jun 2010 15:34:20 -0000
@@ -1388,6 +1388,9 @@ function system_modules_uninstall_submit
     drupal_set_message(t('The selected modules have been uninstalled.'));
 
     $form_state['redirect'] = 'admin/modules/uninstall';
+
+    // Synchronize to catch any actions that were removed.
+    actions_synchronize();
   }
   else {
     $form_state['storage'] = $form_state['values'];
Index: modules/trigger/trigger.install
===================================================================
RCS file: /cvs/drupal/drupal/modules/trigger/trigger.install,v
retrieving revision 1.16
diff -u -p -r1.16 trigger.install
--- modules/trigger/trigger.install	4 Dec 2009 16:49:47 -0000	1.16
+++ modules/trigger/trigger.install	29 Jun 2010 15:34:20 -0000
@@ -43,11 +43,17 @@ function trigger_schema() {
 }
 
 /**
- * Implements hook_install().
+ * Implements hook_enable().
+ *
+ * Removes all assigned orphaned actions while the module has been disabled.
  */
-function trigger_install() {
-  // Do initial synchronization of actions in code and the database.
-  actions_synchronize();
+function trigger_enable() {
+  // Synchronize {trigger_assignments} table with a current set of actions.
+  $select = db_select('actions')
+    ->fields('actions', array('aid'));
+  db_delete('trigger_assignments')
+    ->condition('aid', $select, 'NOT IN')
+    ->execute();
 }
 
 /**
Index: modules/trigger/trigger.test
===================================================================
RCS file: /cvs/drupal/drupal/modules/trigger/trigger.test,v
retrieving revision 1.32
diff -u -p -r1.32 trigger.test
--- modules/trigger/trigger.test	1 May 2010 08:12:23 -0000	1.32
+++ modules/trigger/trigger.test	29 Jun 2010 15:34:20 -0000
@@ -428,6 +428,7 @@ class TriggerOrphanedActionsTestCase ext
     // Disable the module that provides the action and make sure the trigger
     // doesn't white screen.
     module_disable(array('trigger_test'));
+    variable_set('trigger_test_generic_any_action', 0);
     $loaded_node = $this->drupalGetNodeByTitle($edit["title"]);
     $edit["body[$langcode][0][value]"] = '!SimpleTest test body! ' . $this->randomName(32) . ' ' . $this->randomName(32);
     $this->drupalPost("node/$loaded_node->nid/edit", $edit, t('Save'));
@@ -435,5 +436,7 @@ class TriggerOrphanedActionsTestCase ext
     // If the node body was updated successfully we have dealt with the
     // unavailable action.
     $this->assertRaw(t('!post %title has been updated.', array('!post' => 'Basic page', '%title' => $edit["title"])), t('Make sure the Basic page can be updated with the missing trigger function.'));
+    // Action should not have been fired.
+    $this->assertFalse(variable_get('trigger_test_generic_any_action', 0), t('Trigger test action has not been fired.'));
   }
 }
