aboutsummaryrefslogtreecommitdiffstats
path: root/src/libs/utils/stringtable.cpp
Commit message (Collapse)AuthorAgeFilesLines
* StringTable: adapt to QArrayData member name changeMarc Mutz2025-07-111-1/+8
| | | | | | | | | | | | | | | | | | The implementation (in unconditionally-disabled debug code) inspected QArrayData::ref_, which qtbase/3f61f736266ece40d627dcf6214618a22a009fd1 recently renamed to m_ref in order to catch exactly such out-of-tree users. While a re-rename is being merged to qtbase, unblock QtCreator by writing a little helper to extract the member under either name, using Expression SFINAE. As a drive-by, change the implicit Q*Atomc::loadAcquire() into a loadRelaxed(), which is sufficient here, because the code just does calculations on the ref-count number, it needs no memory ordering. Change-Id: Ib9351e1251fc393f8f92ca6076fa725141d396e8 Reviewed-by: hjk <hjk@qt.io>
* StringTable: Make bytesSaved a local variableJarek Kobus2025-02-201-5/+3
| | | | | Change-Id: If82f61715c142951945aeeb02de2b3c76d511a1a Reviewed-by: hjk <hjk@qt.io>
* StringTable: Rename isQStringInUse() into isDetached()Jarek Kobus2025-02-181-3/+3
| | | | | | | | And reverse the return value. Make it aligned with QString::isDetached() logic. Change-Id: Ie191efb1e32080438d43d18d7cb11b37cd11ef5e Reviewed-by: hjk <hjk@qt.io>
* StringTable: Make it QObject-lessJarek Kobus2025-02-111-20/+11
| | | | | | | | | | | | | Replace a QTimer field with a call to single shot timer, guarded by qApp. Make StringTablePrivate QObject-less. This fixes a remaining warning about destroying QTimer object after the qApp is gone. Change-Id: Id71bc17fc72894ad30d277c03e3f09232050d6bb Reviewed-by: Eike Ziller <eike.ziller@qt.io>
* StringTable: Remove redundant isMutable() checkJarek Kobus2025-02-101-2/+2
| | | | | | | | | | | | | | | | | | | | It's included in isShared() already, which looks like: bool isShared() const noexcept { return !d || d->isShared(); } The isMutable() looks like: bool isMutable() const noexcept { return d; } So, if d == nullptr, isShared() == true, thus !isMutable() == true. In this case !isMutable is no-op. Otherwise, if d != nullptr, !isMutable() == false, thus or'ing it with isShared() is also no-op. The public access to isShared() is via the negation of QString::isDetached(). Change-Id: If9a2c3d635504e9f54ae608b192bd9b2fb7a12f5 Reviewed-by: hjk <hjk@qt.io> Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* StringTable: Fix isQStringInUse()Jarek Kobus2025-02-101-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | With the current implementation it always returns true, even when there is only one existing copy of a string inside m_strings set, without any reference. This is due to creating a copy of the QArrayDataPointer: 1 QArrayData::ref / qarraydata.h 2 QArrayDataPointer<char16_t>::ref / qarraydatapointer.h 438 3 QArrayDataPointer<char16_t>::QArrayDataPointer / qarraydatapointer.h 40 4 isQStringInUse So, the ref_ is always at least 2. Avoid creating a copy by taking a reference instead. Observed misbehavior: After switching session nothing is erased from the m_strings, it cumulates indefinitely instead. Task-number: QTCREATORBUG-18800 Change-Id: I17981d44f88307e736ec03380baa39a03f0719bf Reviewed-by: hjk <hjk@qt.io> Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Utils: Rename asynctask.{cpp,h} -> async.{cpp,h}Jarek Kobus2023-05-031-1/+1
| | | | | | | Follows AsyncTask -> Async rename. Change-Id: I37f18368ab826c9960a24087b52f6691bb33f225 Reviewed-by: hjk <hjk@qt.io>
* StringTable: Use QtConcurrent invocation for async runJarek Kobus2023-03-091-5/+5
| | | | | | Change-Id: I33da94ee9d564104edf4b93f1ae40d97adc407fd Reviewed-by: Christian Stenger <christian.stenger@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* Remove GPL-3.0+ from license identifiersKai Köhne2023-01-061-1/+1
| | | | | | | | | | | | | | | Since we also license under GPL-3.0 WITH Qt-GPL-exception-1.0, this applies only to a hypothetical newer version of GPL, that doesn't exist yet. If such a version emerges, we can still decide to relicense... While at it, replace (deprecated) GPL-3.0 with more explicit GPL-3.0-only Change was done by running find . -type f -exec perl -pi -e "s/LicenseRef-Qt-Commercial OR GPL-3.0\+ OR GPL-3.0 WITH Qt-GPL-exception-1.0/LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0/g" {} \; Change-Id: I5097e6ce8d10233993ee30d7e25120e2659eb10b Reviewed-by: Eike Ziller <eike.ziller@qt.io>
* AutoTestUnitTests: Remove TestStringTable scenarioJarek Kobus2022-12-071-11/+3
| | | | | | | | | | | | | Instead, we should provide tst_StringTable that would run GC, make a sleep inside GC being run in other thread and execute destructor of StringTable in main thread. In this case the test should ensure that destructor of StringTable waits for its internal thread to finish. Amends 7a02b39f265f743879832a8ea5ad48767166cb31 Change-Id: I017b5a8f98b41ef6884c43d319858dcb16f17fba Reviewed-by: hjk <hjk@qt.io>
* StringTable: Switch off debug printouts by defaultJarek Kobus2022-12-071-1/+1
| | | | | | | | Amends 7a02b39f265f743879832a8ea5ad48767166cb31 Change-Id: Ie5ee3cd6119adf47149dcfaf4a6847474dcf4dbd Reviewed-by: <github-actions-qt-creator@cristianadam.eu> Reviewed-by: hjk <hjk@qt.io>
* Utils: Promote CppEditor::StringTablehjk2022-12-061-0/+153
It's useful on a more general level, and it's only useful as real singleton. Change-Id: I1da38a8eb6f9332a36261288d1b088ca6204eb7a Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>