cmake: show an error message when project data is invalid
ChooseCMakeInterfaceJob::fileImportDone() calls tryCMakeServer() as a fallback when project data is invalid right after reconfiguring. tryCMakeServer() creates a CMakeServer object and connects to its signals. These signals are emitted asynchronously, because they are scheduled after QProcess::started and QProcess::finished signals. But right after these connections are created, the following events occur synchronously: CMake::FileApi::ImportJob emits result(), ChooseCMakeInterfaceJob's base class ExecuteCompositeJob emits result() and ChooseCMakeInterfaceJob's indirect base class KJob calls deleteLater(). Thus ChooseCMakeInterfaceJob and its server data member are destroyed, the fallback is canceled and the user is not notified about this project configuration error. The tryCMakeServer() fallback never worked correctly, because CMake server code is practically unchanged since 76ddc001, which introduced it. I think no one has ever tested this fallback as its activation is unlikely. I managed to trigger the fallback by removing read and write filesystem permissions for the build/.cmake/api/v1/reply directory. As CMake server mode has been removed since CMake 3.20 in favor of the file-based API, and KDevelop's file API support works correctly with all CMake versions where both the file-based API and the server mode are available, there is no need to make the fallback work correctly. Show an error message instead. Setting error and errorText on the ChooseCMakeInterfaceJob object itself might seem a simpler solution than adding the emitInvalidData option to CMake::FileApi::ImportJob. However this alternative does not work, because ExecuteCompositeJob::slotResult() overwrites the values of these properties with the corresponding values from the last subjob.
parent
1497dd72
Please register or sign in to comment