<table><tr><td style="">mwolff created this revision.<br />Restricted Application added a subscriber: kdevelop-devel.
</td><a style="text-decoration: none; padding: 4px 8px; margin: 0 8px 8px; float: right; color: #464C5C; font-weight: bold; border-radius: 3px; background-color: #F7F7F9; background-image: linear-gradient(to bottom,#fff,#f1f0f1); display: inline-block; border: 1px solid rgba(71,87,120,.2);" href="https://phabricator.kde.org/D8907" rel="noreferrer">View Revision</a></tr></table><br /><div><strong>REVISION SUMMARY</strong><div><p>When KDevelop starts up, we will quite early receive the background<br />
parse requests for the last opened documents in the session. These<br />
then often get added to the background parser (BP) before the project<br />
controller is fully initialized - i.e. before any project was even<br />
tried to be loaded. This means the m_loadingProjects safety guard in<br />
the BP does not kick in and we create parse jobs with "broken"<br />
environments, i.e. missing include paths and defines for kdev-clang.<br />
If, and only if, the document has been modified since the last time<br />
KDevelop was started, we would actually parse the document with the<br />
broken environment, leading to flickering when we show the result<br />
for the broken environment before reparsing it after the project gets<br />
opened with the correct environment. Additionally, this of course<br />
adds useless load to the startup phase and frees up resources better<br />
spent elsewhere at this point.</p>

<p>Note that since the project controller itself delays its<br />
initialization via the eventloop, we have to add a new signal to<br />
ensure we resume the background parser only once we have tried to<br />
open all previous projects, such that the m_loadingProjects safety<br />
guard in the BP can kick in properly.</p>

<p>This is not fully integration-tested, as it's pretty complicated<br />
to do so. Rather, we only test the individual parts automatically.<br />
The full integration test was done manually via:</p>

<ul class="remarkup-list">
<li class="remarkup-list-item">create kdev session and open some project</li>
<li class="remarkup-list-item">open a file in that project</li>
<li class="remarkup-list-item">close session with file still opened</li>
<li class="remarkup-list-item">touch file on disk to force reload on next startup</li>
<li class="remarkup-list-item">restart kdevelop session</li>
<li class="remarkup-list-item">check visually and via CLI output whether file gets reparsed twice, i.e. before the project was loaded and afterwards</li>
</ul>

<p>This patch series ensures it only gets reparsed once after the project<br />
finished importing.</p></div></div><br /><div><strong>REPOSITORY</strong><div><div>R32 KDevelop</div></div></div><br /><div><strong>REVISION DETAIL</strong><div><a href="https://phabricator.kde.org/D8907" rel="noreferrer">https://phabricator.kde.org/D8907</a></div></div><br /><div><strong>AFFECTED FILES</strong><div><div>kdevplatform/shell/core.cpp<br />
kdevplatform/shell/projectcontroller.cpp<br />
kdevplatform/shell/projectcontroller.h<br />
kdevplatform/shell/tests/test_projectcontroller.cpp</div></div></div><br /><div><strong>To: </strong>mwolff<br /><strong>Cc: </strong>kdevelop-devel<br /></div>