1. 15 Jul, 2019 1 commit
  2. 08 Feb, 2019 1 commit
    • Gleb Popov's avatar
      Workaround the bug found by ASan, which can be seen on FreeBSD CI. · af569639
      Gleb Popov authored and Kevin Funk's avatar Kevin Funk committed
      Summary:
      Currently many tests fail (at least on FreeBSD) with ASan turned on. This is what happening:
      
      - `test_toolviewtoolbar` creates an action, a `ToolDocument` and a `View` in the `init()` function.
      - `ToolViewAction` registers itself as event filter for the created `View`.
      - When `cleanup` is called, the controller gets deleted. This causes removal of its children (`QObject::deleteChildren()`), included the mentioned `View`.
      - Somewhere later during destruction, some `QEvent` arrives and gets passed to `ToolViewAction::eventFilter()`. This function accesses `->widget()` method of `m_dock->view()`, but that `View` is already deleted, which causes ASan error.
      
      Note that adding `removeEventFilter()` to `ToolViewAction::~ToolViewAction()` doesn't solve the problem - the event arrival happens before `ToolViewAction` destruction.
      
      Full ASan report:
      
      ```
      ********* Start testing of TestToolViewToolBar *********
      Config: Using QtTest library 5.12.0, Qt 5.12.0 (x86_64-little_endian-lp64 shared (dynamic) release build; by Clang 6.0.1 (tags/RELEASE_601/final 335540))
      PASS   : TestToolViewToolBar::initTestCase()
      =================================================================
      ==21936==ERROR: AddressSanitizer: heap-use-after-free on address 0x6030000958a0 at pc 0x000800465e5a bp 0x7fffffffd230 sp 0x7fffffffd228
      READ of size 8 at 0x6030000958a0 thread T0
          #0 0x800465e59 in QScopedPointer<Sublime::ViewPrivate, QScopedPointerDeleter<Sublime::ViewPrivate> >::operator->() const /usr/local/include/qt5/QtCore/qscopedpointer.h:118:16
          #1 0x80046352f in Sublime::View::widget(QWidget*) /home/arr/projects/kdevelop/kdevplatform/sublime/view.cpp:76:10
          #2 0x800498c53 in ToolViewAction::eventFilter(QObject*, QEvent*) /home/arr/projects/kdevelop/kdevplatform/sublime/idealbuttonbarwidget.cpp:85:40
          #3 0x802027193 in QCoreApplicationPrivate::sendThroughObjectEventFilters(QObject*, QEvent*) (/usr/local/lib/qt5/libQt5Core.so.5+0x427193)
          #4 0x80127decb in QApplicationPrivate::notify_helper(QObject*, QEvent*) (/usr/local/lib/qt5/libQt5Widgets.so.5+0x27decb)
          #5 0x80127f27c in QApplication::notify(QObject*, QEvent*) (/usr/local/lib/qt5/libQt5Widgets.so.5+0x27f27c)
          #6 0x802026ef0 in QCoreApplication::notifyInternal2(QObject*, QEvent*) (/usr/local/lib/qt5/libQt5Core.so.5+0x426ef0)
          #7 0x802051020 in QObjectPrivate::setParent_helper(QObject*) (/usr/local/lib/qt5/libQt5Core.so.5+0x451020)
          #8 0x802050c11 in QObject::~QObject() (/usr/local/lib/qt5/libQt5Core.so.5+0x450c11)
          #9 0x801e4762e in QAbstractAnimation::~QAbstractAnimation() (/usr/local/lib/qt5/libQt5Core.so.5+0x24762e)
          #10 0x801e4cfa4 in QPropertyAnimation::~QPropertyAnimation() (/usr/local/lib/qt5/libQt5Core.so.5+0x24cfa4)
          #11 0x802051461 in QObject::event(QEvent*) (/usr/local/lib/qt5/libQt5Core.so.5+0x451461)
          #12 0x80127dee0 in QApplicationPrivate::notify_helper(QObject*, QEvent*) (/usr/local/lib/qt5/libQt5Widgets.so.5+0x27dee0)
          #13 0x80127f27c in QApplication::notify(QObject*, QEvent*) (/usr/local/lib/qt5/libQt5Widgets.so.5+0x27f27c)
          #14 0x802026ef0 in QCoreApplication::notifyInternal2(QObject*, QEvent*) (/usr/local/lib/qt5/libQt5Core.so.5+0x426ef0)
          #15 0x802027db8 in QCoreApplicationPrivate::sendPostedEvents(QObject*, int, QThreadData*) (/usr/local/lib/qt5/libQt5Core.so.5+0x427db8)
          #16 0x800323331  (/usr/local/lib/qt5/libQt5Test.so.5+0x1e331)
          #17 0x800323bee  (/usr/local/lib/qt5/libQt5Test.so.5+0x1ebee)
          #18 0x800324988  (/usr/local/lib/qt5/libQt5Test.so.5+0x1f988)
          #19 0x80032517b in QTest::qRun() (/usr/local/lib/qt5/libQt5Test.so.5+0x2017b)
          #20 0x800324ef3 in QTest::qExec(QObject*, int, char**) (/usr/local/lib/qt5/libQt5Test.so.5+0x1fef3)
          #21 0x2b97fb in main /home/arr/projects/kdevelop/kdevplatform/sublime/tests/test_toolviewtoolbar.cpp:144:1
      
      0x6030000958a0 is located 16 bytes inside of 24-byte region [0x603000095890,0x6030000958a8)
      freed by thread T0 here:
          #0 0x2b51f2 in operator delete(void*) /usr/src/contrib/compiler-rt/lib/asan/asan_new_delete.cc:149:3
          #1 0x800463371 in Sublime::View::~View() /home/arr/projects/kdevelop/kdevplatform/sublime/view.cpp:61:1
          #2 0x802050de9 in QObjectPrivate::deleteChildren() (/usr/local/lib/qt5/libQt5Core.so.5+0x450de9)
          #3 0x802050bf0 in QObject::~QObject() (/usr/local/lib/qt5/libQt5Core.so.5+0x450bf0)
          #4 0x80041a3be in Sublime::Document::~Document() /home/arr/projects/kdevelop/kdevplatform/sublime/document.cpp:73:21
          #5 0x8004626de in Sublime::ToolDocument::~ToolDocument() /home/arr/projects/kdevelop/kdevplatform/sublime/tooldocument.cpp:48:29
          #6 0x800462708 in Sublime::ToolDocument::~ToolDocument() /home/arr/projects/kdevelop/kdevplatform/sublime/tooldocument.cpp:48:29
          #7 0x802050de9 in QObjectPrivate::deleteChildren() (/usr/local/lib/qt5/libQt5Core.so.5+0x450de9)
          #8 0x802050bf0 in QObject::~QObject() (/usr/local/lib/qt5/libQt5Core.so.5+0x450bf0)
          #9 0x800405d9a in Sublime::Controller::~Controller() /home/arr/projects/kdevelop/kdevplatform/sublime/controller.cpp:113:1
          #10 0x800405dc8 in Sublime::Controller::~Controller() /home/arr/projects/kdevelop/kdevplatform/sublime/controller.cpp:111:1
          #11 0x2b82af in TestToolViewToolBar::cleanup() /home/arr/projects/kdevelop/kdevplatform/sublime/tests/test_toolviewtoolbar.cpp:88:5
          #12 0x2bef0c in TestToolViewToolBar::qt_static_metacall(QObject*, QMetaObject::Call, int, void**) /home/arr/projects/kdevelop/build/kdevplatform/sublime/tests/test_toolviewtoolbar_autogen/EWIEGA46WW/moc_test_toolviewtoolbar.cpp:85:21
          #13 0x8020320ce in QMetaMethod::invoke(QObject*, Qt::ConnectionType, QGenericReturnArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument) const (/usr/local/lib/qt5/libQt5Core.so.5+0x4320ce)
          #14 0x800323318  (/usr/local/lib/qt5/libQt5Test.so.5+0x1e318)
          #15 0x800323bee  (/usr/local/lib/qt5/libQt5Test.so.5+0x1ebee)
          #16 0x800324988  (/usr/local/lib/qt5/libQt5Test.so.5+0x1f988)
          #17 0x80032517b in QTest::qRun() (/usr/local/lib/qt5/libQt5Test.so.5+0x2017b)
          #18 0x800324ef3 in QTest::qExec(QObject*, int, char**) (/usr/local/lib/qt5/libQt5Test.so.5+0x1fef3)
          #19 0x2b97fb in main /home/arr/projects/kdevelop/kdevplatform/sublime/tests/test_toolviewtoolbar.cpp:144:1
      
      previously allocated by thread T0 here:
          #0 0x2b4612 in operator new(unsigned long) /usr/src/contrib/compiler-rt/lib/asan/asan_new_delete.cc:92:3
          #1 0x80041b02e in Sublime::Document::newView(Sublime::Document*) /home/arr/projects/kdevelop/kdevplatform/sublime/document.cpp:117:21
          #2 0x80041a604 in Sublime::Document::createView() /home/arr/projects/kdevelop/kdevplatform/sublime/document.cpp:82:18
          #3 0x2b6eac in TestToolViewToolBar::init() /home/arr/projects/kdevelop/kdevplatform/sublime/tests/test_toolviewtoolbar.cpp:72:22
          #4 0x2beefe in TestToolViewToolBar::qt_static_metacall(QObject*, QMetaObject::Call, int, void**) /home/arr/projects/kdevelop/build/kdevplatform/sublime/tests/test_toolviewtoolbar_autogen/EWIEGA46WW/moc_test_toolviewtoolbar.cpp:84:21
          #5 0x8020320ce in QMetaMethod::invoke(QObject*, Qt::ConnectionType, QGenericReturnArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument) const (/usr/local/lib/qt5/libQt5Core.so.5+0x4320ce)
          #6 0x80032302d  (/usr/local/lib/qt5/libQt5Test.so.5+0x1e02d)
          #7 0x800323bee  (/usr/local/lib/qt5/libQt5Test.so.5+0x1ebee)
          #8 0x800324988  (/usr/local/lib/qt5/libQt5Test.so.5+0x1f988)
          #9 0x80032517b in QTest::qRun() (/usr/local/lib/qt5/libQt5Test.so.5+0x2017b)
          #10 0x800324ef3 in QTest::qExec(QObject*, int, char**) (/usr/local/lib/qt5/libQt5Test.so.5+0x1fef3)
          #11 0x2b97fb in main /home/arr/projects/kdevelop/kdevplatform/sublime/tests/test_toolviewtoolbar.cpp:144:1
      
      SUMMARY: AddressSanitizer: heap-use-after-free /usr/local/include/qt5/QtCore/qscopedpointer.h:118:16 in QScopedPointer<Sublime::ViewPrivate, QScopedPointerDeleter<Sublime::ViewPrivate> >::operator->() const
      ==21936==ABORTING
      ```
      
      Subscribers: kdevelop-devel, #kdevelop
      
      Tags: #kdevelop
      
      Differential Revision: https://phabricator.kde.org/D18463
      
      (cherry picked from commit fbb955c7)
      af569639
  3. 22 Oct, 2018 1 commit
    • Kevin Funk's avatar
      Fix memleaks in unittests · e3c0a1ad
      Kevin Funk authored
      Summary:
      Fix memory leaks in unittests to make it easier to find real memory leaks in the tested code.
      
      Fixed tests:
      - test_projectmodel
      - test_areaoperation
      - test_controller
      - test_toolviewtoolbar
      - test_viewactivation
      
      NOTE: this does not fix all memory leaks in all unittests, this is just s start to keep the changes small
      
      Test Plan:
      - cmake -DCMAKE_BUILD_TYPE=Debug -DECM_ENABLE_SANITIZERS='address' -DBUILD_TESTING=ON ..
      - make test
      
      Many tests will fail because of LSAN (leak sanitizer), which is enabled (at least here) by default with ASAN.
      
      Reviewers: #kdevelop, kfunk
      
      Reviewed By: #kdevelop, kfunk
      
      Subscribers: brauch, kfunk, kdevelop-devel
      
      Tags: #kdevelop
      
      Differential Revision: https://phabricator.kde.org/D16064
      e3c0a1ad
  4. 27 Sep, 2018 2 commits
    • Amish Naidu's avatar
      Sublime: Rename private member of IdealButtonBarLayout for consistency · 03054591
      Amish Naidu authored
      Renamed older member of the class to conform to modern style guidelines
      and consistency with the newly added member.
      
      Okayed on IRC by frinring
      03054591
    • Amish Naidu's avatar
      Sublime: Fix crash when changing areas · 7169b3ac
      Amish Naidu authored
      Summary:
      Fixes regression introduced in D15450 by making IdealButtonBarLayout derive from
      QBoxLayout instead of QLayout and thus delete most operations to Qt instead
      of manually handling them, removing the bugged implementation.
      
      Added minimumSizeHint in IdealToolButton to prevent it from being resized
      to zero.
      
      IdealButtonBarLayout is now a child layout for vertical bars as well,
      the top level layout is stretched and allows for context menu.
      
      BUG: 399025
      
      Reviewers: #kdevelop, kossebau, rjvbb
      
      Reviewed By: #kdevelop, kossebau, rjvbb
      
      Subscribers: kossebau, rjvbb, kdevelop-devel
      
      Tags: #kdevelop
      
      Differential Revision: https://phabricator.kde.org/D15625
      7169b3ac
  5. 15 Sep, 2018 1 commit
    • Amish Naidu's avatar
      Sublime: Fix window growing larger by making tool view buttons shrinkable · b95bc1c3
      Amish Naidu authored
      Summary:
      Items will be shrinked in the IdealButtonBarLayout, instead of
      overflowing and forcing the window larger.
      Geometries are calculated so that only the bigger will be contracted
      while items smaller than a relative threshold won't contract.
      Consequently, the window will no longer grow when changing from Debug to Code.
      
      IdealToolButtons: Instead of simply truncating text, they will elide text while painting.
      
      IdealButtonBarWidget: Previously the layout attached to the object was being used to add
      buttons, which for the bottom bar wrongly meant a super-layout while the
      IdealButtonBarLayout added to this super-layout was being ignored, introduced a new
      member to use the proper layout for all orientations.
      
      BUG: 384711
      
      Reviewers: #kdevelop, kossebau
      
      Reviewed By: #kdevelop, kossebau
      
      Subscribers: kossebau, kdevelop-devel
      
      Tags: #kdevelop
      
      Differential Revision: https://phabricator.kde.org/D15450
      b95bc1c3
  6. 11 Sep, 2018 5 commits
  7. 01 Sep, 2018 1 commit
    • Friedrich W. H. Kossebau's avatar
      Sublime: on View destruction delete widget instantly, instead deleteLater · 8127e3fe
      Friedrich W. H. Kossebau authored
      Summary:
      Having a defined destruction order allows to make more assumptions
      in other code referring to the widgets and avoids extra work to track
      the addditional lifetime of the widget objects (like e.g. needed with
      the KTextEditor::View widget objects, which require the
      KTextEditor::MainWindow to exists as long as there is a View object).
      
      With the Sublime::View and the QWidget objects both bound to the same
      thread which is the UI objects thread by current design, there is also
      no need to defer the deletion into the QWidget object thread.
      
      Test Plan: Have been running this for more than a month, no issues seen.
      
      Reviewers: #kdevelop, kfunk
      
      Reviewed By: #kdevelop, kfunk
      
      Subscribers: kfunk, kdevelop-devel
      
      Tags: #kdevelop
      
      Differential Revision: https://phabricator.kde.org/D15198
      8127e3fe
  8. 30 Aug, 2018 2 commits
  9. 21 Aug, 2018 1 commit
  10. 18 Aug, 2018 1 commit
  11. 17 Aug, 2018 1 commit
  12. 15 Aug, 2018 3 commits
  13. 13 Aug, 2018 1 commit
  14. 30 Jul, 2018 2 commits
  15. 28 Jul, 2018 1 commit
    • Friedrich W. H. Kossebau's avatar
      Fix KTextEditor::MainWindow to outlive the KTextEditor::View objects · 1641d714
      Friedrich W. H. Kossebau authored
      Summary:
      The KTextEditor::MainWindow API requires that the MainWindow wrapper
      object passed to the created KTextEditor::View objects "stays valid
      for the complete lifetime of the view."
      
      The old code had Shell::MainWindow own the MainWindow wrapper
      object as child object, thus deleting as part of its own destruction.
      Though any KTextEditor::View objects still alive are being deleted
      with deleteLater(), so only destructed on the next QEvent::DeferredDelete
      handling. And they still assume they can access the MainWindow wrapper
      during their shutdown as normal, e.g. to call "MainWindow::deleteViewBar".
      
      To get things into some proper order again, this patch adds a method
      KTextEditorIntegration::MainWindow::startDestroy(), which now is called
      in the destruction of Shell::MainWindow instead of instantly deleting the
      MainWindow wrapper object as normal child object. The method starts a
      delayed delete instead, to outlive any TextEditor::View objects
      being deleteLatered() inside the Core::self()->shutdown().
      
      KTextEditorIntegration::MainWindow also gets fixed to know about the
      state of being destroyed and in that case no longer do things on the
      former mainwindow object.
      
      The patch also moves the layout code for stacking the viewbars into a
      new special class Sublime::ViewBarContainer. That solves lifetime and
      ownership handling of the widget and the layout, and hides the
      implementation detail behind a simple API.
      While this makes viewBarContainer() no longer a simple plain widget
      to be customized by any caller, no other user is known which would need
      that.
      
      Reviewers: #kdevelop, croick, mwolff
      
      Subscribers: kdevelop-devel
      
      Tags: #kdevelop
      
      Differential Revision: https://phabricator.kde.org/D13905
      1641d714
  16. 22 Jul, 2018 1 commit
  17. 18 Jul, 2018 1 commit
  18. 20 Jun, 2018 1 commit
  19. 17 May, 2018 1 commit
  20. 25 Mar, 2018 2 commits
    • Kevin Funk's avatar
      sublime: Release space in tab bar when no status · 1ec19dcb
      Kevin Funk authored
      Release the space taken for e.g. status texts like "Line: xx Col: yy" in the
      right corner of the tab bar in case the status text is disabled/empty.
      
      CCBUG: 314167
      1ec19dcb
    • Kevin Funk's avatar
      Properly save state of KTextEditor Views · 9d4bd897
      Kevin Funk authored
      Summary:
      Call the KTextEditor::View methods for reading & storing the state:
      - KTextEditor::View::readSessionConfig()
      - KTextEditor::View::writeSessionConfig()
      
      Remove our implementation of storing the state of ...:
      - Cursor
      - Selection
      
      By using the KTextEditor methods we do save the states of ...:
      - Cursor
      - Dynamic Word Wrap
      - Text Folding nodes
      - ...
      
      Thus, with this patch the storing & retrieving of the selection state is
      lost. To be honest, I don't see that as a super useful feature anyway.
      
      FIXED-IN: 5.3.0
      BUG: 385919
      
      Reviewers: mwolff
      
      Reviewed By: mwolff
      
      Subscribers: mwolff, kdevelop-devel
      
      Differential Revision: https://phabricator.kde.org/D11601
      9d4bd897
  21. 21 Feb, 2018 1 commit
  22. 04 Dec, 2017 2 commits
  23. 22 Nov, 2017 2 commits
    • René J.V. Bertin's avatar
      kdevelop: prevent empty dockwidget context menuitems · f4363a08
      René J.V. Bertin authored and Kevin Funk's avatar Kevin Funk committed
      Summary:
      This patch prevents dock widgets (toolviews) from having empty items in their context menus. Most the corresponding actions can probably not be represented in menus anyway and are thus unlikely to do anything when triggered through a menu. The average user doesn't know that though.
      
      The patch achieves this by filtering out QActions that would not have a title in `IdealDockWidget::contextMenuRequested()` but also adds a menu item text to two actions which I think make sense to include in the context menu. (Doing this makes it possible to hide the toolview's toolbar in more situations, gaining a bit of vertical space.)
      
      BUG: 386911
      FIXED-IN: 5.2.1
      
      Test Plan:
      Works as intended on Mac and Linux/X11 .
      
      I understand there may be another way to detect QActions that cannot be represented in menus but haven't yet found such an alternative. Such an alternative could be used in addition to the empty text check which I think should be done as argued in the summary.
      
      Individual plugins can also override `IToolViewFactor::contextMenuActions()`.
      
      Reviewers: kfunk
      
      Reviewed By: kfunk
      
      Subscribers: kdevelop-devel
      
      Tags: #kdevelop
      
      Differential Revision: https://phabricator.kde.org/D8954
      f4363a08
    • Friedrich W. H. Kossebau's avatar
      Fix progress widget on bottom bar not being shown in some sessions · a35de90c
      Friedrich W. H. Kossebau authored
      Reviewers: #kdevelop, flherne
      
      Reviewed By: #kdevelop, flherne
      
      Subscribers: flherne, apol, kdevelop-devel
      
      Differential Revision: https://phabricator.kde.org/D8929
      a35de90c
  24. 21 Nov, 2017 1 commit
  25. 30 Oct, 2017 1 commit
  26. 28 Oct, 2017 1 commit
  27. 29 Sep, 2017 2 commits