Uploaded image for project: 'Qt Creator'
  1. Qt Creator
  2. QTCREATORBUG-26001

Potential crash in text editor on shutdown

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P1: Critical
    • Resolution: Done
    • Affects Version/s: Qt Creator 5.0.0-beta1
    • Fix Version/s: Qt Creator 5.0.0-rc1
    • Component/s: Editors
    • Labels:
      None
    • Commits:
      0420caa3ceebd32221d15f1c81b44b3033ae4391 (qt-creator/qt-creator/5.0)

      Description

      To reproduce: apply the https://codereview.qt-project.org/c/qt-creator/qt-creator/+/359521. Run Creator, open cpp editor and type some text. Undo all your changes and then close creator (it should close without asking for saving modifications). Observe printouts. It may happen that scheduleUpdateHighlightScrollBar appears after the destruction of TextEditorWidgetPrivate.

      The call stack:

      1  TextEditor::Internal::TextEditorWidgetPrivate::scheduleUpdateHighlightScrollBar                                                                                                                                                                                    texteditor.cpp                   6473 0x7fffccbac4ad 
      2  QtPrivate::FunctorCall<QtPrivate::IndexesList<>, QtPrivate::List<>, void, void (TextEditor::Internal::TextEditorWidgetPrivate:: *)()>::call(void (TextEditor::Internal::TextEditorWidgetPrivate:: *)(), TextEditor::Internal::TextEditorWidgetPrivate *, void * *) qobjectdefs_impl.h               152  0x7fffccbd834f 
      3  QtPrivate::FunctionPointer<void (TextEditor::Internal::TextEditorWidgetPrivate:: *)()>::call<QtPrivate::List<>, void>(void (TextEditor::Internal::TextEditorWidgetPrivate:: *)(), TextEditor::Internal::TextEditorWidgetPrivate *, void * *)                       qobjectdefs_impl.h               185  0x7fffccbd637f 
      4  QtPrivate::QSlotObject<void (TextEditor::Internal::TextEditorWidgetPrivate:: *)(), QtPrivate::List<>, void>::impl(int, QtPrivate::QSlotObjectBase *, QObject *, void * *, bool *)                                                                                  qobjectdefs_impl.h               418  0x7fffccbd2139 
      5  QtPrivate::QSlotObjectBase::call                                                                                                                                                                                                                                   qobjectdefs_impl.h               398  0x7ffff635ccdf 
      6  doActivate<false>                                                                                                                                                                                                                                                  qobject.cpp                      3886 0x7ffff639c3cd 
      7  QMetaObject::activate                                                                                                                                                                                                                                              qobject.cpp                      3946 0x7ffff6395dc1 
      8  TextEditor::TextDocumentLayout::updateExtraArea                                                                                                                                                                                                                    moc_textdocumentlayout.cpp       145  0x7fffcca9a877 
      9  TextEditor::TextDocumentLayout::requestExtraAreaUpdate                                                                                                                                                                                                             textdocumentlayout.cpp           528  0x7fffccb871de 
      10 TextEditor::TextDocument::removeMarkFromMarksCache                                                                                                                                                                                                                 textdocument.cpp                 1043 0x7fffccb8089f 
      11 TextEditor::TextDocument::removeMark                                                                                                                                                                                                                               textdocument.cpp                 1071 0x7fffccb80b43 
      12 ClangCodeModel::Internal::ClangDiagnosticManager::cleanMarks                                                                                                                                                                                                       clangdiagnosticmanager.cpp       275  0x7fffc477c0cf 
      13 ClangCodeModel::Internal::ClangDiagnosticManager::~ClangDiagnosticManager                                                                                                                                                                                          clangdiagnosticmanager.cpp       269  0x7fffc477bff8 
      14 ClangCodeModel::Internal::ClangEditorDocumentProcessor::~ClangEditorDocumentProcessor                                                                                                                                                                              clangeditordocumentprocessor.cpp 104  0x7fffc4787d17 
      15 ClangCodeModel::Internal::ClangEditorDocumentProcessor::~ClangEditorDocumentProcessor                                                                                                                                                                              clangeditordocumentprocessor.cpp 104  0x7fffc4787d3e 
      16 QScopedPointerDeleter<CppTools::BaseEditorDocumentProcessor>::cleanup                                                                                                                                                                                              qscopedpointer.h                 60   0x7fffc4907bb4 
      17 QScopedPointer<CppTools::BaseEditorDocumentProcessor, QScopedPointerDeleter<CppTools::BaseEditorDocumentProcessor>>::~QScopedPointer                                                                                                                               qscopedpointer.h                 107  0x7fffc4907a19 
      18 CppEditor::Internal::CppEditorDocument::~CppEditorDocument                                                                                                                                                                                                         cppeditordocument.h              45   0x7fffc49077cc 
      19 CppEditor::Internal::CppEditorDocument::~CppEditorDocument                                                                                                                                                                                                         cppeditordocument.h              45   0x7fffc4907824 
      20 QtSharedPointer::CustomDeleter<TextEditor::TextDocument, QtSharedPointer::NormalDeleter>::execute                                                                                                                                                                  qsharedpointer_impl.h            187  0x7fffccbd7a43 
      21 QtSharedPointer::ExternalRefCountWithCustomDeleter<TextEditor::TextDocument, QtSharedPointer::NormalDeleter>::deleter                                                                                                                                              qsharedpointer_impl.h            205  0x7fffccbd53fb 
      22 QtSharedPointer::ExternalRefCountData::destroy                                                                                                                                                                                                                     qsharedpointer_impl.h            149  0x7fffccaa7871 
      23 QSharedPointer<TextEditor::TextDocument>::deref                                                                                                                                                                                                                    qsharedpointer_impl.h            458  0x7fffccbd19de 
      24 QSharedPointer<TextEditor::TextDocument>::deref                                                                                                                                                                                                                    qsharedpointer_impl.h            453  0x7fffccbccd08 
      25 QSharedPointer<TextEditor::TextDocument>::~QSharedPointer                                                                                                                                                                                                          qsharedpointer_impl.h            310  0x7fffccbc731a 
      26 TextEditor::Internal::TextEditorWidgetPrivate::~TextEditorWidgetPrivate                                                                                                                                                                                            texteditor.cpp                   866  0x7fffccb8a0e6 
      27 TextEditor::Internal::TextEditorWidgetPrivate::~TextEditorWidgetPrivate                                                                                                                                                                                            texteditor.cpp                   866  0x7fffccb8a11a 
      28 TextEditor::TextEditorWidget::~TextEditorWidget                                                                                                                                                                                                                    texteditor.cpp                   1101 0x7fffccb8b78c 
      29 CppEditor::Internal::CppEditorWidget::~CppEditorWidget                                                                                                                                                                                                             cppeditorwidget.cpp              315  0x7fffc493db46 
      30 CppEditor::Internal::CppEditorWidget::~CppEditorWidget                                                                                                                                                                                                             cppeditorwidget.cpp              315  0x7fffc493db68 
      31 TextEditor::BaseTextEditor::~BaseTextEditor                                                                                                                                                                                                                        texteditor.cpp                   7962 0x7fffccbb4d06 
      32 CppEditor::Internal::CppEditor::~CppEditor                                                                                                                                                                                                                         cppeditor.h                      33   0x7fffc4a1df5a 
      33 CppEditor::Internal::CppEditor::~CppEditor                                                                                                                                                                                                                         cppeditor.h                      33   0x7fffc4a1df76 
      34 Core::Internal::EditorManagerPrivate::closeEditors                                                                                                                                                                                                                 editormanager.cpp                1755 0x7fffccfb5832 
      35 Core::EditorManager::closeEditors                                                                                                                                                                                                                                  editormanager.cpp                3003 0x7fffccfbc659 
      36 Core::EditorManager::closeDocuments                                                                                                                                                                                                                                editormanager.cpp                3381 0x7fffccfbda5d 
      37 Core::EditorManager::closeAllEditors                                                                                                                                                                                                                               editormanager.cpp                2723 0x7fffccfbade2 
      38 operator()                                                                                                                                                                                                                                                         editormanager.cpp                728  0x7fffccfafbde 
      39 std::__invoke_impl<bool, Core::Internal::EditorManagerPrivate::extensionsInitialized()::<lambda()>&>(std::__invoke_other, struct {...} &)                                                                                                                          invoke.h                         61   0x7fffccfc1c28 
      40 std::__invoke_r<bool, Core::Internal::EditorManagerPrivate::extensionsInitialized()::<lambda()>&>(struct {...} &)                                                                                                                                                  invoke.h                         114  0x7fffccfc132f 
      41 std::_Function_handler<bool(), Core::Internal::EditorManagerPrivate::extensionsInitialized()::<lambda()>>::_M_invoke(const std::_Any_data &)                                                                                                                       std_function.h                   291  0x7fffccfc0594 
      42 std::function<bool ()>::operator()() const                                                                                                                                                                                                                         std_function.h                   560  0x7fffcd07107c 
      43 Core::Internal::MainWindow::closeEvent                                                                                                                                                                                                                             mainwindow.cpp                   372  0x7fffcd0c1a99 
      44 QWidget::event                                                                                                                                                                                                                                                     qwidget.cpp                      8828 0x7ffff7426593 
      45 QMainWindow::event                                                                                                                                                                                                                                                 qmainwindow.cpp                  1341 0x7ffff75a0007 
      46 QApplicationPrivate::notify_helper                                                                                                                                                                                                                                 qapplication.cpp                 3637 0x7ffff73dbba7 
      47 QApplication::notify                                                                                                                                                                                                                                               qapplication.cpp                 3587 0x7ffff73db9bb 
      48 QCoreApplication::notifyInternal2                                                                                                                                                                                                                                  qcoreapplication.cpp             1064 0x7ffff634b782 
      49 QCoreApplication::sendSpontaneousEvent                                                                                                                                                                                                                             qcoreapplication.cpp             1474 0x7ffff634c184 
      50 QWidgetPrivate::close_helper                                                                                                                                                                                                                                       qwidget.cpp                      8252 0x7ffff7425004 
      51 QWidgetWindow::handleCloseEvent                                                                                                                                                                                                                                    qwidgetwindow.cpp                848  0x7ffff7455ec1 
      52 QWidgetWindow::event                                                                                                                                                                                                                                               qwidgetwindow.cpp                256  0x7ffff74539ac 
      53 QApplicationPrivate::notify_helper                                                                                                                                                                                                                                 qapplication.cpp                 3637 0x7ffff73dbba7 
      54 QApplication::notify                                                                                                                                                                                                                                               qapplication.cpp                 2977 0x7ffff73d8f91 
      55 QCoreApplication::notifyInternal2                                                                                                                                                                                                                                  qcoreapplication.cpp             1064 0x7ffff634b782 
      56 QCoreApplication::sendSpontaneousEvent                                                                                                                                                                                                                             qcoreapplication.cpp             1474 0x7ffff634c184 
      57 QGuiApplicationPrivate::processCloseEvent                                                                                                                                                                                                                          qguiapplication.cpp              2639 0x7ffff6aee295 
      58 QGuiApplicationPrivate::processWindowSystemEvent                                                                                                                                                                                                                   qguiapplication.cpp              2046 0x7ffff6aec010 
      59 QWindowSystemInterface::sendWindowSystemEvents                                                                                                                                                                                                                     qwindowsysteminterface.cpp       1169 0x7ffff6acbe77 
      60 xcbSourceDispatch                                                                                                                                                                                                                                                  qxcbeventdispatcher.cpp          105  0x7fffe4e3df67 
      61 g_main_context_dispatch                                                                                                                                                                                                                                                                                  0x7ffff2e3d4cf 
      62 g_main_context_iterate.constprop                                                                                                                                                                                                                                                                         0x7ffff2e914e8 
      63 g_main_context_iteration                                                                                                                                                                                                                                                                                 0x7ffff2e3ac03 
      64 QEventDispatcherGlib::processEvents                                                                                                                                                                                                                                qeventdispatcher_glib.cpp        423  0x7ffff63db6bc 
      65 QXcbGlibEventDispatcher::processEvents                                                                                                                                                                                                                             qxcbeventdispatcher.cpp          143  0x7fffe4e3e184 
      66 QEventLoop::processEvents                                                                                                                                                                                                                                          qeventloop.cpp                   139  0x7ffff6348111 
      67 QEventLoop::exec                                                                                                                                                                                                                                                   qeventloop.cpp                   232  0x7ffff634841b 
      68 QCoreApplication::exec                                                                                                                                                                                                                                             qcoreapplication.cpp             1375 0x7ffff634bf9a 
      69 QGuiApplication::exec                                                                                                                                                                                                                                              qguiapplication.cpp              1867 0x7ffff6aeb94c 
      70 QApplication::exec                                                                                                                                                                                                                                                 qapplication.cpp                 2829 0x7ffff73d898d 
      71 main                                                                                                                                                                                                                                                               main.cpp                         778  0x40e384       
      

      Frame 26 shows that we have left the TextEditorWidgetPrivate d'tor and we didn't hit its base QObject d'tor yet. Frame 25 comes from destructing the member fields of TextEditorWidgetPrivate. Qt can't know, that TextEditorWidgetPrivate has been already destructed, so it still delivers signals to slots in TextEditorWidgetPrivate.

        Attachments

          Issue Links

          No reviews matched the request. Check your Options in the drop-down menu of this sections header.

            Activity

              People

              Assignee:
              jkobus Jarek Kobus
              Reporter:
              jkobus Jarek Kobus
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:

                  Gerrit Reviews

                  There are no open Gerrit changes