Skip to content

Commit

Permalink
Fixed bug regarding two plugins matching the same one-shot trigger/alias
Browse files Browse the repository at this point in the history
  • Loading branch information
nickgammon committed Oct 17, 2013
1 parent 4349853 commit 0cd1b1f
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 3 deletions.
10 changes: 9 additions & 1 deletion ProcessPreviousLine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -894,6 +894,7 @@ assemble the full text of the original line.

int iDeletedCount = 0;
int iDeletedNonTemporaryCount = 0;
set<CPlugin *> pluginsWithDeletions;

for (OneShotItemMap::const_iterator one_shot_it = mapOneShotItems.begin ();
one_shot_it != mapOneShotItems.end ();
Expand Down Expand Up @@ -922,11 +923,18 @@ assemble the full text of the original line.
// now delete its entry
GetTriggerMap ().RemoveKey (strTriggerName);

pluginsWithDeletions.insert (m_CurrentPlugin);

} // end of deleting one-shot items

if (iDeletedCount > 0)
{
SortTriggers ();
// make sure we sort the correct plugin(s)
for ( set<CPlugin *>::iterator i = pluginsWithDeletions.begin (); i != pluginsWithDeletions.end (); i++)
{
m_CurrentPlugin = *i;
SortTriggers ();
}

if (iDeletedNonTemporaryCount > 0) // plugin mods don't really count
SetModifiedFlag (TRUE); // document has changed
Expand Down
12 changes: 10 additions & 2 deletions evaluate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,7 @@ CAliasList AliasList;

int iDeletedCount = 0;
int iDeletedNonTemporaryCount = 0;
set<CPlugin *> pluginsWithDeletions;

for (OneShotItemMap::const_iterator one_shot_it = mapOneShotItems.begin ();
one_shot_it != mapOneShotItems.end ();
Expand Down Expand Up @@ -205,11 +206,18 @@ CAliasList AliasList;
// now delete its entry
GetAliasMap ().RemoveKey (strAliasName);

} // end of deleting one-shot items
pluginsWithDeletions.insert (m_CurrentPlugin);

} // end of deleting one-shot items

if (iDeletedCount > 0)
{
SortAliases ();
// make sure we sort the correct plugin(s)
for ( set<CPlugin *>::iterator i = pluginsWithDeletions.begin (); i != pluginsWithDeletions.end (); i++)
{
m_CurrentPlugin = *i;
SortAliases ();
}

if (iDeletedNonTemporaryCount > 0) // plugin mods don't really count
SetModifiedFlag (TRUE); // document has changed
Expand Down

0 comments on commit 0cd1b1f

Please sign in to comment.