Review Request 117394: Kdevelop crash when setting CMake variables bugfix suggestion

Pavel Petrushkov onehundredof at
Sat Apr 5 21:27:40 UTC 2014

This is an automatically generated e-mail. To reply, visit:

Review request for KDevelop.

Repository: kdevelop


Explanation of bug:
After CMake settings were changed file watcher starts reloading project via CMakeManager::reload. At the same time settings dialog(CMakePreferences.cpp) starts reloading same project via Project::reloadModel() after running cmakejob. Problem is that CMakeManager doesn't set project's private loading variable so reloadModel starts working and deletes project's root ProjectFolderItem(topItem). First reload still has a pointer to that deleted ProjectFolderItem and it crashes while trying to access it. These bugs: 332934, 328699, 312314 have very similar backtraces -- they all have two threads running CMakeImportJob::initialize(which are hidden in and one of them is crashing while trying to reference ProjectBaseItem::url(::path in newer versions). Also, bug happens only sometimes, that's probably because first reload manages to finish before second one starts. On faster PCs and bigger projects bug may not be detectable. Changing CMAKE_BUILD_TYPE almost always crashes my KDevelop. 

Solution suggestion:
I haven't come up with solution that doesn't look ugly so I'll just post one. Since I haven't found a public method to set project's loading var I just call Project::reloadModel() instead of creating import job manually. Project is going to be reloaded anyway so it should not break anything except it reloads 2 times now. Also doing that kind of makes CMakeManager::reload useless. Perhaps I should call reloadModel from cmakemanager only when CMakeCache.txt was changed and manual job in other cases? Anyway I need your advice on how to properly fix the problem.


  projectmanagers/cmake/cmakemanager.cpp 7a34b37 



Manual, KDevelop doesn't seem to crash anymore.


Pavel Petrushkov

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the KDevelop-devel mailing list