~registry/codeblocks/trunk

« back to all changes in this revision

Viewing changes to src/plugins/codecompletion/parser/parser.cpp

  • Committer: loaden
  • Date: 2011-07-19 11:24:01 UTC
  • Revision ID: svn-v4:98b59c6a-2706-0410-b7d6-d2fa1a1880c9:trunk:7288
* CC: Fix a hang when find token matches

Show diffs side-by-side

added added

removed removed

Lines of Context:
391
391
    return result;
392
392
}
393
393
 
394
 
size_t Parser::FindMatches(const wxString& s, TokenList& result, bool caseSensitive, bool is_prefix)
395
 
{
396
 
    wxCriticalSectionLocker locker(s_TokensTreeCritical);
397
 
    result.clear();
398
 
    TokenIdxSet tmpresult;
399
 
    if (!m_TokensTree->FindMatches(s, tmpresult, caseSensitive, is_prefix))
400
 
        return 0;
401
 
 
402
 
    TokenIdxSet::iterator it;
403
 
    for (it = tmpresult.begin(); it != tmpresult.end(); ++it)
404
 
    {
405
 
        Token* token = m_TokensTree->at(*it);
406
 
        if (token)
407
 
        result.push_back(token);
408
 
    }
409
 
    return result.size();
410
 
}
411
 
 
 
394
// No critical section needed here:
 
395
// All functions that call this, already entered a critical section.
412
396
size_t Parser::FindMatches(const wxString& s, TokenIdxSet& result, bool caseSensitive, bool is_prefix)
413
397
{
414
 
    wxCriticalSectionLocker locker(s_TokensTreeCritical);
415
398
    result.clear();
416
399
    TokenIdxSet tmpresult;
417
400
    if (!m_TokensTree->FindMatches(s, tmpresult, caseSensitive, is_prefix))