Important: Please read the Qt Code of Conduct -

Tracking down a Qt Creator Editor Plugin Segfault

  • So, I'm evaluating Qt Creator as the basis of a cross-platform Processing/Arduino IDE replacement. So far the architecture looks imminently compatible. To learn about the plugin system I am going through the old VCreateLogic plugin tutorial. It has its problems, it shows it's age, but it is proving to be a reasonable start. However, I have come up against a problem that I'm having trouble solving. I'm currently trying to get the HtmlEditor plugin example working and, though the plugin loads correctly, it Segfaults as soon as it tries to open a file.

    The stack trace is shown below:
    @0 QLayout::addChildWidget(QWidget*) /usr/lib64/ 0 0x7ffff6ef9e0b
    1 QStackedLayout::insertWidget(int, QWidget*) /usr/lib64/ 0 0x7ffff6f05872
    2 Core::Internal::EditorView::addEditor(Core::IEditor*) /home/share/Download/IDEs/Qt_Creator/2.5.0/qt-creator-2.5.0-src/lib/qtcreator/plugins/Nokia/ 0 0x7fffed1bb8ab
    3 Core::EditorManager::placeEditor(Core::Internal::EditorView*, Core::IEditor*) /home/share/Download/IDEs/Qt_Creator/2.5.0/qt-creator-2.5.0-src/lib/qtcreator/plugins/Nokia/ 0 0x7fffed1adce1
    4 Core::EditorManager::activateEditor(Core::Internal::EditorView*, Core::IEditor*, QFlagsCore::EditorManager::OpenEditorFlag) /home/share/Download/IDEs/Qt_Creator/2.5.0/qt-creator-2.5.0-src/lib/qtcreator/plugins/Nokia/ 0 0x7fffed1add26
    5 Core::EditorManager::openEditor(Core::Internal::EditorView*, QString const&, Core::Id const&, QFlagsCore::EditorManager::OpenEditorFlag, bool*) /home/share/Download/IDEs/Qt_Creator/2.5.0/qt-creator-2.5.0-src/lib/qtcreator/plugins/Nokia/ 0 0x7fffed1b1281
    6 Core::EditorManager::openEditor(QString const&, Core::Id const&, QFlagsCore::EditorManager::OpenEditorFlag, bool*) /home/share/Download/IDEs/Qt_Creator/2.5.0/qt-creator-2.5.0-src/lib/qtcreator/plugins/Nokia/ 0 0x7fffed1b14e5
    7 Core::Internal::MainWindow::openFiles(QStringList const&, Core::ICore::OpenFilesFlags) /home/share/Download/IDEs/Qt_Creator/2.5.0/qt-creator-2.5.0-src/lib/qtcreator/plugins/Nokia/ 0 0x7fffed18ead4
    8 Core::Internal::MainWindow::openFile() /home/share/Download/IDEs/Qt_Creator/2.5.0/qt-creator-2.5.0-src/lib/qtcreator/plugins/Nokia/ 0 0x7fffed18eec4
    9 Core::Internal::MainWindow::qt_metacall(QMetaObject::Call, int, void**) /home/share/Download/IDEs/Qt_Creator/2.5.0/qt-creator-2.5.0-src/lib/qtcreator/plugins/Nokia/ 0 0x7fffed255215
    10 QMetaObject::activate(QObject*, QMetaObject const*, int, void**) /usr/lib64/ 0 0x7ffff66a35aa
    11 QAction::triggered(bool) /usr/lib64/ 0 0x7ffff6ec9622
    12 QAction::qt_metacall(QMetaObject::Call, int, void**) /usr/lib64/ 0 0x7ffff6ecac17
    13 QMetaObject::activate(QObject*, QMetaObject const*, int, void**) /usr/lib64/ 0 0x7ffff66a35aa
    14 QAction::triggered(bool) /usr/lib64/ 0 0x7ffff6ec9622
    15 QAction::activate(QAction::ActionEvent) /usr/lib64/ 0 0x7ffff6ec980f
    16 ?? /usr/lib64/ 0 0x7ffff72ffa09
    17 ?? /usr/lib64/ 0 0x7ffff7305642
    18 QWidget::event(QEvent*) /usr/lib64/ 0 0x7ffff6f20306
    19 QMenu::event(QEvent*) /usr/lib64/ 0 0x7ffff7306bab
    20 QApplicationPrivate::notify_helper(QObject*, QEvent*) /usr/lib64/ 0 0x7ffff6ecfc34
    ... <More>

    It is clearly something to do with an invalid pointer to a widget, but I cannot trace where exactly the issue lies. I've obviously done far too much "single LED" debugging on deeply embedded projects, because I know it should be a simple trail to follow. I just can't figure it out however. I have been debugging it using the Qt Creator in Qt Creator model, but I cannot seem to build a debug version of Qt Creator ( and thus have access to the debug symbols ) due to an error:

    No rule to make target ../../../qt-creator-2.5.0-src/src/plugins/coreplugin/Core.pluginspec', needed by../../../lib/qtcreator/plugins/Nokia/'. Stop.

    I am using the default build location - out of tree - though I have read that an out of tree build can potentially cause issues, it is at the same level as the source however. I have tried whole tree cleans to no avail. I'm running out of ideas.

    Any assistance would be greatly appreciated.

  • Moderators

    Out of tree builds of creator work (for me and the others of the Qt Creator team at least;-) as do debug builds. Build and source dirs need to be at the same level of the directory tree, but you say you do that.

    The pluginspec files are created by qmake AFAIR, so did you try to re-run qmake?

  • Yes, indeed I did try re-running qmake. It's definitely strange. There must be something odd with my configuration here.

    I've moved the build into the source tree and it builds properly in debug mode, so perhaps I'll just have to work this way until I figure out where the qmake process is falling down. I now have full debug symbols which should make finding the segfault much easier than with minimally marked-up, optimized, asm. I am going to pull a fresh source tree just to make sure that there was nothing I borked while working on some of the earlier tutorial plugins ( that were built in tree ).

    On the other hand, I implemented a very simple OutputPane plugin that runs with no issues whatsoever. The Segfault that I am seeing with the hacked code from the tutorial is no where to be found. So, if nothing else, I can continue with my project. I like good news.

    Thanks to the team for an exceptionally clean and powerful IDE base! This actually has the potential of being a fun project.

  • Just a quick not to say that I found the segfault source. Another change since the tutorial was written meant that I was not calling setWidget() in the IEditor instance. As a result, the widget was being returned as 0, resulting, as might be expected, in a SegFault.

    Thanks again... until the next problem.

Log in to reply