-
Notifications
You must be signed in to change notification settings - Fork 105
fix: ispaused invalid iterator #205
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -256,9 +256,20 @@ namespace SourceHook | |
|
||
ICleanupTask *m_CleanupTask; | ||
|
||
bool isValidIterator(List<CHook>::iterator &myIter, List<CHook> &myList) { | ||
for (auto iter = myList.begin(); iter != myList.end(); ++iter) { | ||
if (iter == myIter) { | ||
return true; | ||
} | ||
} | ||
return false; | ||
} | ||
|
||
void SkipPaused(List<CHook>::iterator &iter, List<CHook> &list) | ||
{ | ||
while (iter != list.end() && iter->IsPaused()) | ||
if (!iter || !isValidIterator(iter, list)) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What's your basis for believing There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. i have edited my PR description to answer what you asked for |
||
iter = list.end(); | ||
while (iter != list.end() && iter && iter->IsPaused()) | ||
++iter; | ||
} | ||
public: | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is inefficient, there are better ways to go about this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what are the better ways? using this?