1. 21 Oct, 2020 18 commits
    • Milian Wolff's avatar
      Fix memory leak in TestProblemStoreNode · f23e0618
      Milian Wolff authored
      Fixes LSAN report:
      Direct leak of 32 byte(s) in 1 object(s) allocated from:
          #0 0x7f7448582f41 in operator new(unsigned long) /build/gcc/src/gcc/libsanitizer/asan/asan_new_delete.cpp:99
          #1 0x55676af99e7c in TestProblemStoreNode::testLabelNode() /home/milian/projects/kf5/src/extragear/kdevelop/kdevelop/kdevplatform/shell/tests/test_problemstorenode.cpp:99
    • Milian Wolff's avatar
      Fix memory leak in TestMICommandQueue · ed1c215b
      Milian Wolff authored
      Fixes LSAN report:
      Indirect leak of 416 byte(s) in 4 object(s) allocated from:
          #0 0x7f28c3788f41 in operator new(unsigned long) /build/gcc/src/gcc/libsanitizer/asan/asan_new_delete.cpp:99
          #1 0x55fa025c17a6 in TestMICommandQueue::addAndTake() /home/milian/projects/kf5/src/extragear/kdevelop/kdevelop/plugins/debuggercommon/tests/test_micommandqueue.cpp:100
          #2 0x55fa025b8bc8 in TestMICommandQueue::qt_static_metacall(QObject*, QMetaObject::Call, int, void**) plugins/debuggercommon/tests/test_micommandqueue_autogen/EWIEGA46WW/moc_test_micommandqueue.cpp:89
    • Milian Wolff's avatar
    • Milian Wolff's avatar
      Fix UB due to access of partially destroyed object in ~UiController · 6db6e096
      Milian Wolff authored
      Fixes UBSAN warning:
      /home/milian/projects/kf5/src/extragear/kdevelop/kdevelop/kdevplatform/shell/uicontroller.cpp:232:57: runtime error: member call on address 0x60400043c250 which does not point to an object of type 'UiController'
      0x60400043c250: note: object is of type 'Sublime::Controller'
       9c 00 00 25  b8 10 ee ba 89 7f 00 00  20 ec 0f 00 80 60 00 00  80 2a 63 00 60 60 00 00  e8 c0 76 bb
                    vptr for 'Sublime::Controller'
          #0 0x7f89c8d7c300 in operator() /home/milian/projects/kf5/src/extragear/kdevelop/kdevelop/kdevplatform/shell/uicontroller.cpp:232
    • Milian Wolff's avatar
      Use an option to decide whether benchmarks should be compiled · 07902e14
      Milian Wolff authored
      By default, this option is disabled for debug builds and enabled
      for any other builds.
      Now, we can even add it for debug builds, e.g. to get ASAN coverage
      for the benchmarks.
    • Milian Wolff's avatar
      Fix -Wstrict-aliasing compiler warnings by cleaning up the code · 7e8aee2c
      Milian Wolff authored
      Just return a value instead of using an out parameter here...
    • Milian Wolff's avatar
    • Kai Stierand's avatar
      bench_itemrepository: use std::shuffle instead of std::random_shuffle · 1a0998eb
      Kai Stierand authored
      According to https://en.cppreference.com/w/cpp/algorithm/random_shuffle
      std::random_shuffle has been removed in C++17 and actually was removed in
      MSVC now.
    • Milian Wolff's avatar
    • Daniel Schürmann's avatar
      Pretty printing for QVariant · 5c35e757
      Daniel Schürmann authored
      This adds QVariantPrinter printer to qt.py
      The output looks like that:
      QVariant(int, 5)
      QVariant(QString, "Hello World")
    • Milian Wolff's avatar
      Fix binding loop in Heading.qml · cd7a0277
      Milian Wolff authored
    • Milian Wolff's avatar
    • Milian Wolff's avatar
      Simplify code by leveraging QHash::take · 848f3ceb
      Milian Wolff authored
    • Milian Wolff's avatar
      Port away from deprecated QDBusConnectionInterface::serviceOwnerChanged · c82e3644
      Milian Wolff authored
      Instead, use QDBusConnectionInterface::serviceRegistered
      and QDBusConnectionInterface::serviceUnregistered. This removes
      a runtime warning about connecting to the deprecated signal
      and also cleans up the code somewhat too. Win Win :)
    • Igor Kushnir's avatar
      Reuse existing elements of PathFilter::m_items · b37a289d
      Igor Kushnir authored
      This elimination of memory reallocation, redundant ProjectFile
      construction and destruction, dramatically speeds up
      ProjectFileDataProvider::reset() when a huge project is open.
      Consider WebKit project with almost 320 thousand files in total and 13
      of these files open: the average time spent in
      ProjectFileDataProvider::reset() went from 80 ms to 7 ms (starting from
      the second call to this function, because memory is still allocated and
      all ProjectFile objects are still created in the first call to it).
      BenchQuickOpen::benchProjectFileFilter_reset() runs 8 times faster with
      this change.
    • Igor Kushnir's avatar
      Remove duplicate calls to PathFilter::clearFilter() · 9d55d42b
      Igor Kushnir authored
      At the end of each reset() function there is an unconditional call to
      PathFilter::setItems(), which unconditionally calls clearFilter().
      clearFilter() always overwrites both variables it modifies. Neither of
      these two variables is otherwise used in the reset() implementations.
      Make clearFilter() private because it is now called only by PathFilter
    • Igor Kushnir's avatar
      ProjectFileDataProvider: inefficient loop => std algorithm · b58315ce
      Igor Kushnir authored
      Let N = m_projectFiles.size(). Let M be the number of files in
      m_projectFiles that are also present in openFiles(). The complexity of
      the loop is O(N*M), because each call to QVector::erase() moves on
      average N/2 elements. The complexity of std::remove_copy_if is O(N).
      This change measurably speeds up ProjectFileDataProvider::reset() when a
      huge project is open.
      Consider WebKit project with almost 320 thousand files in total and only
      13 of these files open: the average time spent in
      ProjectFileDataProvider::reset() went from 92 ms to 80 ms.
      This change slows down BenchQuickOpen::benchProjectFileFilter_reset() by
      12%, because this benchmark does not open any files, and the loop turns
      out to be faster than std::remove_copy_if when no files are removed. The
      cases of zero or one open document from all open projects should be rare
      enough in practice to not worry much about their performance.
      ProjectFileDataProvider::reset() should be pretty fast in these cases
    • Milian Wolff's avatar
      Require Qt 5.9 at a minimum · ebee2f1f
      Milian Wolff authored
      This allows us to use QTest::addRow among other things.
  2. 20 Oct, 2020 5 commits
    • Igor Kushnir's avatar
      Replace bitwise operators with Q_DECLARE_OPERATORS_FOR_FLAGS · 08a82a9c
      Igor Kushnir authored
      Use default QFlags constructor instead of the deprecated constructor
      that takes nullptr.
      Remove static_cast<int> inside QCOMPARE in
      TestDUChain::testReparseOnDocumentActivated(), because Qt Test prints
      QFlags as integer Actual and Expected values.
    • Igor Kushnir's avatar
      Overload bitwise operators for TopDUContext::Features · 8552fe7c
      Igor Kushnir authored
      Less casting leads to more readable code.
      static_cast<int> inside QCOMPARE in
      TestDUChain::testReparseOnDocumentActivated() to make Qt Test print
      Actual and Expected values.
    • Igor Kushnir's avatar
      Add parentheses in two identical complex expressions · b6dab981
      Igor Kushnir authored
      Saves future readers of the code from looking up the relative priority
      in a C++ operator precedence table.
    • Kai Stierand's avatar
      fix: clang-tidy analysis stops on error · b032ba2e
      Kai Stierand authored
    • Tristan Porteries's avatar
      Fix document switcher plugin with multiple splitted view. · 00e3ff73
      Tristan Porteries authored
      In differential D20548 an issue with document switcher plugin and
      splitted views is described.
      The solution is to open/activate document instead of activating
      view (aka Sublime::View) as view are linked to area (aka Sublime::Area)
      and will show again in same area instead of current active area.
      But the differential solution was trying to retrieve the document
      from activated view which is not the perfect way as it must handle
      Sublime::UrlDocument to have a url for openDocument function.
      This patch use the document controller (aka IDocumentController)
      instead of sublime components.
      The plugin tracks a list of document (aka IDocument) and
      enables signals for open/activate/close actions.
      Every document is placed in list model via DocumentSwitcherItem
      class responsible of extracting text and icon from a document
      passed in its constructor.
      Without dependency to sublime, the plugin structure is
      simplified by not taking care about active main window, active
      area, and views. Only documents are tracking independently of the
      way they are displayed in UI.
      Subscribers: kdevelop-devel
      Tags: #kdevelop
      Differential Revision: https://phabricator.kde.org/D24428
  3. 18 Oct, 2020 3 commits
    • Igor Kushnir's avatar
      Merge branch '5.6' into master · f2e0a292
      Igor Kushnir authored
    • Igor Kushnir's avatar
      Optimize StatusbarProgressWidget::connectSingleItem() · ff1c26d4
      Igor Kushnir authored
      For each progress value report StatusBar::showProgress() calls
      ProgressItem::setUsesBusyIndicator(), which eventually results in a call
      to StatusbarProgressWidget::connectSingleItem(). The return value of
      ProgressManager::instance()->singleItem() changes very rarely between
      these calls. Let us avoid reconnecting the same signal/slot pair
    • Igor Kushnir's avatar
      Don't show a busy indicator for 5s after a task completion · 0d87cab9
      Igor Kushnir authored
      81220db1 eliminated such misleading
      progress reports for items that use a busy indicator themselves, but
      missed the case when a quick percent-progress-reporting task follows
      right after a busy-indicator task.
      For example, GrepJob's WorkCollectFiles step uses a busy indicator, then
      its next WorkGrep step reports progress in percents. So when the
      WorkGrep step is completed in less than a second (e.g. when there are
      not many files to search in and the looked-for string is not present in
      any of them), the bottom-right-corner progress bar shows
      a busy indicator for 5 seconds.
      Let us display 100% progress during these 5 seconds instead.
  4. 17 Oct, 2020 14 commits
    • Igor Kushnir's avatar
      Revert "Revert "Safely finalize and destroy DebugSession objects"" · 2c7cb50d
      Igor Kushnir authored
      The fix was reverted in 5.6 because it broke the ABI. The ABI break is
      acceptable for the master branch => revert the reverting commit.
      This reverts commit 1a61900c.
    • Igor Kushnir's avatar
      Merge branch '5.6' into master · d8069a7d
      Igor Kushnir authored
    • Milian Wolff's avatar
      Fix memory leaks in test_path · 63de6396
      Milian Wolff authored
      Don't use QTest::newRow(qstrdup(...)), use QTest::addRow("%s", ...)
    • Milian Wolff's avatar
      Don't leak the AutoTestShell · 2fb1007f
      Milian Wolff authored
      This was reported by LSAN in multiple tests.
    • Milian Wolff's avatar
      Don't cast partially destroyed objects on shutdown · 6bbcaf4c
      Milian Wolff authored
      Fixes UBSAN warning:
      /home/milian/projects/kf5/src/extragear/kdevelop/kdevelop/kdevplatform/debugger/variable/variablecollection.cpp:517:39: runtime error: downcast of address 0x6190002fe480 which does not point to an object of type 'View'
      0x6190002fe480: note: object is of type 'QWidget'
       16 02 00 7e  a8 ea fb a2 36 7f 00 00  40 20 0a 00 40 61 00 00  58 ec fb a2 36 7f 00 00  00 00 be be
                    vptr for 'QWidget'
          #0 0x7f36b128079f in KDevelop::VariableCollection::viewDestroyed(QObject*) /home/milian/projects/kf5/src/extragear/kdevelop/kdevelop/kdevplatform/debugger/variable/variablecollection.cpp:517
    • Milian Wolff's avatar
      Don't leak the ProgressManager items · ea6894c4
      Milian Wolff authored
      Fixes tons of leaks reported in test_projectcontroller.
    • Milian Wolff's avatar
      minor: don't inline the StatusBar dtor · 2c3ade7e
      Milian Wolff authored
      We will have to do this everywhere, to prevent the vtable
      from potentially accidentally being inlined.
    • Milian Wolff's avatar
      Fix memory leaks in test_projectcontroller · 598b3082
      Milian Wolff authored
      Use std::unique_ptr for factory functions.
    • Milian Wolff's avatar
      Pre-initialize values in CorePrivate · 5e87f5bb
      Milian Wolff authored
      Fixes UBSAN warnings in some tests which install a custom controller
      before initializing the core. E.g.:
      ********* Start testing of TestProjectController *********
      Config: Using QtTest library 5.15.1, Qt 5.15.1 (x86_64-little_endian-lp64 shared (dynamic) release build; by GCC 10.2.0)
      /home/milian/projects/kf5/src/extragear/kdevelop/kdevelop/kdevplatform/shell/core.cpp:336:15: runtime error: load of value 3200171710, which is not a valid value for type 'Setup'
          #0 0x7f3724cf4d43 in KDevelop::Core::setupFlags() const /home/milian/projects/kf5/src/extragear/kdevelop/kdevelop/kdevplatform/shell/core.cpp:336
          #1 0x7f3724c996c7 in KDevelop::PluginControllerPrivate::initKTextEditorIntegration() /home/milian/projects/kf5/src/extragear/kdevelop/kdevelop/kdevplatform/shell/plugincontroller.cpp:297
          #2 0x7f3724c4f759 in KDevelop::PluginController::PluginController(KDevelop::Core*) /home/milian/projects/kf5/src/extragear/kdevelop/kdevelop/kdevplatform/shell/plugincontroller.cpp:357
          #3 0x55fca7edb240 in FakePluginController::PluginController(KDevelop::Core*) /home/milian/projects/kf5/src/extragear/kdevelop/kdevelop/kdevplatform/shell/tests/test_projectcontroller.cpp:140
          #4 0x55fca7edb240 in TestProjectController::initTestCase() /home/milian/projects/kf5/src/extragear/kdevelop/kdevelop/kdevplatform/shell/tests/test_projectcontroller.cpp:165
    • Milian Wolff's avatar
      Don't leak memory when cloning a session · cac0243c
      Milian Wolff authored
      Fixes various LSAN reports in ./bin/test_sessioncontroller.
    • Milian Wolff's avatar
    • Milian Wolff's avatar
      Silence leak warning in editorconfig_parse · f4002032
      Milian Wolff authored
      Probably a real leak, but within the thirdparty library, so let's ignore this for now.
    • Igor Kushnir's avatar
      Revert "Safely finalize and destroy DebugSession objects" · 1a61900c
      Igor Kushnir authored
      This fix broke the ABI, kdev-python no longer compiles. Therefore it
      must be reverted in the stable 5.6 branch.
      This reverts commit 37ff587e.
    • Milian Wolff's avatar