https://bugs.kde.org/show_bug.cgi?id=474749

            Bug ID: 474749
           Summary: KDevelop crashes when adding wxWidgets
    Classification: Applications
           Product: kdevelop
           Version: 5.12.230801
          Platform: Other
                OS: Linux
            Status: REPORTED
          Severity: crash
          Priority: NOR
         Component: Language Support: CPP (Clang-based)
          Assignee: kdevelop-bugs-n...@kde.org
          Reporter: cabral....@gmail.com
  Target Milestone: ---

Created attachment 161765
  --> https://bugs.kde.org/attachment.cgi?id=161765&action=edit
main.cpp with #include wx.h and CMakeLists.txt with wxWidgets package
configured

Have wxWidgets installed.
```
$ wx-config --cxxflags --libs
-I/usr/lib/wx/include/gtk3-unicode-3.2 -I/usr/include/wx-3.2 -DWXUSINGDLL
-D__WXGTK3__ -D__WXGTK__ -pthread
-pthread -lwx_gtk3u_xrc-3.2 -lwx_gtk3u_html-3.2 -lwx_gtk3u_qa-3.2
-lwx_gtk3u_core-3.2 -lwx_baseu_xml-3.2 -lwx_baseu_net-3.2 -lwx_baseu-3.2 
```

Create a new project from template "Terminal" (hello world with cmake).

Add to main.cpp the widgets header
```
#include <wx/wx.h>
```
Add wxWidgets package to the CMakeLists.txt
```
find_package(wxWidgets REQUIRED)
include(${wxWidgets_USE_FILE})
```

Saving CMakeLists.txt trigger KDevelop to start cmake reconfiguration and
during the "Background parser", KDevelop crashes.

If one removes the `#include`, the reconfiguration does not crash, but adding
it back and reconfiguring will crash.
If one has the `#include`, but not the `find_package()` and reconfigures,
KDevelop does not crash.

Only when both are present is that KDevelop crashes, and only during
auto-reconfigure (the crash happens during the "Background parser").

It also crashes if the CMakeLists.txt uses `wx-config`, but as before, only if
there is `#include` in the code.

```
# wx-config-qt or wx-config
execute_process(COMMAND wx-config-qt --cxxflags
    RESULT_VARIABLE CMD_RES
    OUTPUT_VARIABLE wx_CFLAGS
    ERROR_VARIABLE ERR_VAR
    OUTPUT_STRIP_TRAILING_WHITESPACE)
separate_arguments(wx_CFLAGS)
message("wx_CFLAGS ${wx_CFLAGS}")

# wx-config-qt or wx-config
execute_process(COMMAND wx-config-qt --libs
    RESULT_VARIABLE CMD_RES
    OUTPUT_VARIABLE wx_LIBS
    ERROR_VARIABLE ERR_VAR
    OUTPUT_STRIP_TRAILING_WHITESPACE)
message("wx_LIBS ${wx_LIBS}")

target_compile_options(${PROJECT_NAME} PUBLIC ${wx_CFLAGS})
target_link_libraries(${PROJECT_NAME} ${wx_LIBS})
```

Tested on Ubuntu and Biglinux (Manjaro).
Tested with wxWidgets-qt and wxWidgets-gtk3.
```
$ wx-config-qt --cxxflags --libs
-I/usr/lib/wx/include/qt-unicode-3.2 -I/usr/include/wx-3.2 -DWXUSINGDLL
-D__WXQT__ -DQT_CORE_LIB -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB
-DQT_GUI_LIB -DQT_CORE_LIB -DQT_OPENGL_LIB -DQT_WIDGETS_LIB -DQT_GUI_LIB
-DQT_CORE_LIB -DQT_TESTLIB_LIB -DQT_CORE_LIB -pthread
-pthread -lwx_qtu_xrc-3.2 -lwx_qtu_html-3.2 -lwx_qtu_qa-3.2 -lwx_qtu_core-3.2
-lwx_baseu_xml-3.2 -lwx_baseu_net-3.2 -lwx_baseu-3.2
```

Building from the command line it compiles fine.

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to