| 233 | } |
| 234 | |
| 235 | void ProjectFileDataProvider::projectClosing(IProject* project) |
| 236 | { |
| 237 | // Once we remove all project's files from set, there is no need to listen |
| 238 | // to &IProject::fileRemovedFromSet signal from this project and waste time |
| 239 | // searching in m_projectFiles. No need to listen to &IProject::fileAddedToSet |
| 240 | // signal from this project either - we are not interested in hypothetical |
| 241 | // file additions to the project that is about to be closed and destroyed. |
| 242 | disconnect(project, nullptr, this, nullptr); |
| 243 | |
| 244 | if (ICore::self()->projectController()->projectCount() == 0) { |
| 245 | // No open projects left => just remove all files. This is a little faster |
| 246 | // than the algorithm below. Releasing the memory here would slow down the |
| 247 | // next call to projectOpened() => keep the capacity of m_projectFiles. |
| 248 | m_projectFiles.clear(); |
| 249 | return; |
| 250 | } |
| 251 | |
| 252 | const Path projectPath = project->path(); |
| 253 | const auto logicalEnd = std::remove_if(m_projectFiles.begin(), m_projectFiles.end(), |
| 254 | [&projectPath](const ProjectFile& f) { |
| 255 | return f.projectPath == projectPath; |
| 256 | }); |
| 257 | m_projectFiles.erase(logicalEnd, m_projectFiles.end()); |
| 258 | } |
| 259 | |
| 260 | void ProjectFileDataProvider::projectOpened(IProject* project) |
| 261 | { |
nothing calls this directly
no test coverage detected