Patch #2887 2009-12-29 00:03
techy
Parserthread doesn't check if the file exists (debug15)- Download
- 2887-Parserthread_d.patch (1.2 KB)
Index: src/plugins/codecompletion/parser/parserthread.cpp
===================================================================
--- src/plugins/codecompletion/parser/parserthread.cpp (revision 5986)
+++ src/plugins/codecompletion/parser/parserthread.cpp (working copy)
@@ -337,14 +337,21 @@
{
if (!m_IsBuffer)
{
- m_Filename = m_Buffer;
- m_FileSize = wxFile(m_Filename).Length();
+ wxFile file(m_Buffer);
+
+ if (file.IsOpened())
+ {
+ m_Filename = m_Buffer;
+ m_FileSize = file.Length();
- TRACE(_T("InitTokenizer() : m_Filename='%s', m_FileSize=%d."), m_Filename.c_str(), m_FileSize);
+ TRACE(_T("InitTokenizer() : m_Filename='%s', m_FileSize=%d."), m_Filename.c_str(), m_FileSize);
- bool ret = m_Tokenizer.Init(m_Filename, m_Options.loader);
- Delete(m_Options.loader);
- return ret;
+ bool ret = m_Tokenizer.Init(m_Filename, m_Options.loader);
+ Delete(m_Options.loader);
+ return ret;
+ }
+
+ return false;
}
return m_Tokenizer.InitFromBuffer(m_Buffer);
History
techy 2009-12-29 00:05
Two more problems I've encountered today. Parserthread gets a list of all project files, but some of these files might not exist any more. Parserthread should detect this before trying to get the length of the file.