summaryrefslogtreecommitdiff
path: root/src/plugins/cpptools/stringtable.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Merge CppTools into CppEditorChristian Kandeler2021-09-011-182/+0
| | | | | | | | | | | | | | | | There was no proper separation of responsibilities between these plugins. In particular, CppTools had lots of editor-related functionality, so it's not clear why it was separated out in the first place. In fact, for a lot of code, it seemed quite arbitrary where it was put (just one example: switchHeaderSource() was in CppTools, wheras switchDeclarationDefinition() was in CppEditor). Merging the plugins will enable us to get rid of various convoluted pseudo-abstractions that were only introduced to keep up the artificial separation. Change-Id: Iafc3bce625b4794f6d4aa03df6cddc7f2d26716a Reviewed-by: Christian Stenger <christian.stenger@qt.io>
* Add TestStringTable scenarioJarek Kobus2021-06-021-0/+11
| | | | | | | | | | | | | | | | | | | | | | | | | This scenario is used for testing against regression in StringTable. If the scenario went OK, the creator finishes and doesn't crash. Later, this scenario will be invoked from additional test, so that the second instance of creator will run and the test will check if the subprocess finished OK. So it's going to be combined with autotests in the follow up patch. In order to test it, run creator with the following command line: "-settingspath ~/.config -scenario TestStringTable". Make sure, that you point settingspath to creator settings which have proper kit with a toolchain and Qt setup. The regression may be tested by restoring the src/plugins/cpptools/stringtable.cpp to the parent of f4ab1279fd55a00e2bede18ec9ad283c668b46bd and by applying on top of it this patch (simple conflict may need to be resolved). In this case running this scenario ends up with a crash (so, it confirms this test fails on the old code form before the fix). Change-Id: Icbb56233495047fd68bfb605fcd088f352a16323 Reviewed-by: hjk <hjk@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* StringTable: Ensure only one GC() thread is running at a timeJarek Kobus2021-04-191-31/+29
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The possible issue with the current implementation is that in theory many possible GC() are being executed in parallel. In this case just one of them is really working and others are waiting on the locked mutex (first line of the GC() method). In such a scenario when a call to StringTablePrivate::insert() is being executed from one more thread, it may happen that the working GC() thread is stopped (since m_stopGCRequested.fetchAndStoreAcquire(true) was executed from insert()) and later the mutex lock may be granted to the other awaiting GC() thread instead to the thread which executes insert() method. In this unlikely scenario the GC() thread won't be canceled and the lock inside the insert() method may be locked for considerable amount of time, what is not desired. The goal of this patch is to resolve the possible issue above and to simplify the code by eliminating the m_stopGCRequested variable and make use of QFuture.cancel() / QFuture.isCanceled() API instead. In addition, since we control now only one possible thread that executes the GC(), there is no need for future synchonizer anymore. GC() function can't be run in parallel in different threads, as the whole body of GC() is protected with mutex. This means that whenever a new scheduled call to GC() is being executed, this new call waits on the mentioned mutex at the beginning of GC(). So, instead of protecting the whole body of GC() with a mutex, we ensure that the old call to GC() is already finished (if not, we also cancel the old call) while preparing an asynchronous call to start a new GC() from inside startGC() method. Whenever we are calling the insert() method, we still protect the access to m_strings with a mutex (as insert() is designed to be called from different threads in parallel). Just after locking the mutex we are canceling any possible ongoing call to GC(). After canceling the GC() call, we are sure that no new call to GC() will be executed until we unlock the mutex, so it's safe now to modify the m_string data. Change-Id: If72d0a6f98fb414c6c63117bc9baa667d17e1ffe Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
* Fix a possible crash in StringTable on shutdownJarek Kobus2021-04-091-11/+20
| | | | | | | | | | | | | | | | | | The issue is that when a GC() function is being executed in a separate thread, the main thread may delete the StringTable (on shutdown) in the same time. The destructor of StringTable didn't check in any way that the other thread is still executing GC() method. In order to fix it we employ runAsync method, returning the handle to the running task. We store the handle in futureSynchronizer, and in destructor of StringTablePrivate we safely wait for all futures to be finished. Fixes: QTCREATORBUG-25417 Change-Id: I0039d6041276c521c221e8dfc3894e84e47b82a2 Reviewed-by: Christian Stenger <christian.stenger@qt.io> Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
* StringTable: Use QElapsedTimer instead of QTimeJarek Kobus2021-03-261-5/+4
| | | | | Change-Id: I75065cbe32dcd4405360b90f3f51387f286d6186 Reviewed-by: hjk <hjk@qt.io>
* Use typed syntax in calls to QMetaObject::invokeMethodJarek Kobus2020-11-161-1/+2
| | | | | | | | | We do it wherever possible. Some places can't be fixed since they still rely on dynamic introspection (mainly QQuickItem cases). Change-Id: Ia00b4a04d8b995c9a43b7bf2dbe76a60364bb8ca Reviewed-by: Eike Ziller <eike.ziller@qt.io>
* CppTools: Fix Qt6 build wrt internal QString changesEike Ziller2020-09-151-2/+7
| | | | | | | Task-number: QTCREATORBUG-24098 Change-Id: Ic1f72365a696993b3e81e9600b3b89d75d5e8bc4 Reviewed-by: hjk <hjk@qt.io>
* CppTools: Use a normal plugin pimpl member for StringTablehjk2020-02-061-2/+2
| | | | | Change-Id: I2804b623b7ec03f6f4375452c9a422604468aafa Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
* Partial compile fix for current Qt dev and/or Qt 6hjk2019-11-121-0/+2
| | | | | | | | This does not cover Utils::MapReduceOption with QVector, and code that's not compiled on my machine. Change-Id: Ib63923985c52b1bb74e5ec2068a2bb37469ac618 Reviewed-by: Eike Ziller <eike.ziller@qt.io>
* CppTools: modernizeAlessandro Portale2019-01-211-1/+1
| | | | | | Change-Id: Iaf02e4d026f1ac8b216833d83cd7a735e21ff60a Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io> Reviewed-by: Orgad Shaneh <orgads@gmail.com>
* Prefer using 'override' instead of 'virtual'Alessandro Portale2018-07-111-1/+1
| | | | | | | | warning: prefer using 'override' or (rarely) 'final' instead of 'virtual' [modernize-use-override] Change-Id: I6dac7a62b627fa1353b4455e1af92f869c2571cc Reviewed-by: Marco Benelli <marco.benelli@qt.io>
* CppTools: Apply 'static' pattern to StringTablehjk2018-02-071-10/+48
| | | | | | | | This also fixes a crash on loading (some?) projects introduced in 577bf7c08a. Change-Id: Ie35d466fa3b84b183118fe93f55393a4c59755de Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
* CppTools: Avoid QT_SUPPORT macroOrgad Shaneh2017-06-061-1/+1
| | | | | | | It is deprecated, and GCC7 warns about RHS expansion to defined. Change-Id: I161ee9c566ee12d0e443a9054dd0e5cdadc0518e Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
* Update License according to agreement with Free Qt FoundationTobias Hunger2016-01-191-17/+12
| | | | | | | * Update files in src/plugins Change-Id: Ia5d77fad7d19d4bb3498e78661982f68729adb22 Reviewed-by: Tobias Hunger <tobias.hunger@theqtcompany.com>
* Merge commit '3c85058694ee2e41658d17f524fb48f0b187d2fe'Eike Ziller2015-02-121-6/+6
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/libs/utils/tooltip/tipcontents.cpp src/libs/utils/tooltip/tipcontents.h src/plugins/android/androiddeployqtstep.cpp src/plugins/baremetal/baremetalconstants.h src/plugins/baremetal/baremetaldevice.cpp src/plugins/baremetal/baremetaldevice.h src/plugins/baremetal/baremetaldeviceconfigurationwidget.cpp src/plugins/baremetal/baremetaldeviceconfigurationwidget.h src/plugins/baremetal/baremetaldeviceconfigurationwizard.cpp src/plugins/baremetal/baremetaldeviceconfigurationwizardpages.cpp src/plugins/baremetal/baremetaldeviceconfigurationwizardpages.h src/plugins/baremetal/baremetalplugin.cpp src/plugins/baremetal/baremetalplugin.h src/plugins/baremetal/baremetalruncontrolfactory.cpp src/plugins/baremetal/baremetalruncontrolfactory.h src/plugins/cppeditor/cppcodemodelinspectordialog.cpp src/plugins/cppeditor/cppdoxygen_test.cpp src/plugins/cppeditor/cppdoxygen_test.h src/plugins/debugger/breakpointmarker.cpp src/plugins/debugger/debuggeritemmodel.cpp src/plugins/debugger/debuggeritemmodel.h src/plugins/debugger/loadcoredialog.cpp src/plugins/genericprojectmanager/cppmodelmanagerhelper.cpp src/plugins/projectexplorer/addnewmodel.cpp src/plugins/projectexplorer/addnewmodel.h src/plugins/projectexplorer/jsonwizard/jsonfieldpage.cpp src/plugins/qmlprofiler/abstracttimelinemodel.cpp src/plugins/qmlprofiler/abstracttimelinemodel.h src/plugins/qmlprofiler/notesmodel.cpp src/plugins/qmlprofiler/qml/CategoryLabel.qml src/plugins/qmlprofiler/qml/MainView.qml src/plugins/qmlprofiler/qml/Overview.js src/plugins/qmlprofiler/qml/Overview.qml src/plugins/qmlprofiler/qml/TimeDisplay.qml src/plugins/qmlprofiler/qml/TimeMarks.qml src/plugins/qmlprofiler/qmlprofilertimelinemodelproxy.cpp src/plugins/qmlprofiler/sortedtimelinemodel.cpp src/plugins/qmlprofiler/sortedtimelinemodel.h src/plugins/qmlprofiler/timelinemodelaggregator.cpp src/plugins/qmlprofiler/timelinemodelaggregator.h src/plugins/qmlprofiler/timelinerenderer.cpp src/plugins/qmlprofiler/timelinerenderer.h src/plugins/qmlprojectmanager/QmlProjectManager.json.in src/plugins/texteditor/findinfiles.cpp src/plugins/vcsbase/vcsconfigurationpage.cpp src/shared/qbs src/shared/scriptwrapper/interface_wrap_helpers.h src/shared/scriptwrapper/wrap_helpers.h tests/auto/qmlprofiler/abstracttimelinemodel/tst_abstracttimelinemodel.cpp tests/system/suite_debugger/tst_debug_empty_main/test.py tests/system/suite_debugger/tst_qml_js_console/test.py tests/system/suite_debugger/tst_qml_locals/test.py Change-Id: I67540b648f8b162496f4aa606b04d50c7c9125c6
| * Update LicenseEike Ziller2015-01-161-6/+6
| | | | | | | | | | Change-Id: I711d5fb475ef814a1dc9d2822740e827f3f67125 Reviewed-by: Alessandro Portale <alessandro.portale@digia.com>
* | Port to new connect apiMontel Laurent2015-01-301-2/+1
|/ | | | | Change-Id: I873a36601d54065b61d0666558b93dc839ad0dfc Reviewed-by: hjk <hjk@theqtcompany.com>
* C++: Only start/stop timers from the UI thread.Erik Verbruggen2014-11-181-3/+1
| | | | | | Change-Id: Ib694d2aeaef3b62caf3d3624e6b1c3e643197c2d Reviewed-by: Christian Kandeler <christian.kandeler@theqtcompany.com> Reviewed-by: Nikolai Kosjar <nikolai.kosjar@theqtcompany.com>
* Merge remote-tracking branch 'origin/3.2'Eike Ziller2014-10-141-7/+8
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/libs/utils/ipaddresslineedit.cpp src/libs/utils/logging.h src/plugins/analyzerbase/AnalyzerBase.pluginspec.in src/plugins/android/Android.pluginspec.in src/plugins/android/androiddeploystep.cpp src/plugins/android/androiddeploystep.h src/plugins/android/androiddeploystepfactory.cpp src/plugins/android/androiddeploystepwidget.cpp src/plugins/android/androidpackagecreationfactory.cpp src/plugins/android/androidpackagecreationstep.cpp src/plugins/android/androidpackagecreationstep.h src/plugins/android/androidpackagecreationwidget.cpp src/plugins/android/androidpackagecreationwidget.h src/plugins/android/javafilewizard.cpp src/plugins/autotoolsprojectmanager/AutotoolsProjectManager.pluginspec.in src/plugins/baremetal/BareMetal.pluginspec.in src/plugins/bazaar/Bazaar.pluginspec.in src/plugins/beautifier/Beautifier.pluginspec.in src/plugins/bineditor/BinEditor.pluginspec.in src/plugins/bookmarks/Bookmarks.pluginspec.in src/plugins/clangcodemodel/ClangCodeModel.pluginspec.in src/plugins/clangcodemodel/clanghighlightingsupport.cpp src/plugins/clangcodemodel/clangsymbolsearcher.cpp src/plugins/classview/ClassView.pluginspec.in src/plugins/clearcase/ClearCase.pluginspec.in src/plugins/cmakeprojectmanager/CMakeProjectManager.pluginspec.in src/plugins/cmakeprojectmanager/cmakeeditorfactory.cpp src/plugins/cmakeprojectmanager/cmakehighlighter.cpp src/plugins/coreplugin/Core.pluginspec.in src/plugins/cpaster/CodePaster.pluginspec.in src/plugins/cppeditor/CppEditor.pluginspec.in src/plugins/cppeditor/cppfilewizard.cpp src/plugins/cpptools/CppTools.pluginspec.in src/plugins/cpptools/cpphighlightingsupportinternal.cpp src/plugins/cpptools/cppmodelmanagerinterface.cpp src/plugins/cpptools/cppmodelmanagerinterface.h src/plugins/cvs/CVS.pluginspec.in src/plugins/debugger/Debugger.pluginspec.in src/plugins/designer/Designer.pluginspec.in src/plugins/diffeditor/DiffEditor.pluginspec.in src/plugins/emacskeys/EmacsKeys.pluginspec.in src/plugins/fakevim/FakeVim.pluginspec.in src/plugins/genericprojectmanager/GenericProjectManager.pluginspec.in src/plugins/git/Git.pluginspec.in src/plugins/git/gitorious/gitorious.cpp src/plugins/git/gitorious/gitorious.h src/plugins/git/gitorious/gitoriousclonewizard.cpp src/plugins/git/gitorious/gitorioushostwidget.cpp src/plugins/git/gitorious/gitorioushostwidget.h src/plugins/git/gitorious/gitorioushostwizardpage.cpp src/plugins/git/gitorious/gitoriousprojectwidget.cpp src/plugins/git/gitorious/gitoriousprojectwidget.h src/plugins/git/gitorious/gitoriousprojectwizardpage.cpp src/plugins/git/gitorious/gitoriousprojectwizardpage.h src/plugins/git/gitorious/gitoriousrepositorywizardpage.cpp src/plugins/git/gitorious/gitoriousrepositorywizardpage.h src/plugins/glsleditor/GLSLEditor.pluginspec.in src/plugins/glsleditor/glsleditorfactory.cpp src/plugins/glsleditor/glslfilewizard.cpp src/plugins/helloworld/HelloWorld.pluginspec.in src/plugins/help/Help.pluginspec.in src/plugins/imageviewer/ImageViewer.pluginspec.in src/plugins/ios/Ios.pluginspec.in src/plugins/macros/Macros.pluginspec.in src/plugins/mercurial/Mercurial.pluginspec.in src/plugins/perforce/Perforce.pluginspec.in src/plugins/projectexplorer/ProjectExplorer.pluginspec.in src/plugins/pythoneditor/PythonEditor.pluginspec.in src/plugins/pythoneditor/pythoneditorwidget.cpp src/plugins/pythoneditor/wizard/pythonfilewizard.cpp src/plugins/qbsprojectmanager/QbsProjectManager.pluginspec.in src/plugins/qbsprojectmanager/defaultpropertyprovider.cpp src/plugins/qmakeprojectmanager/QmakeProjectManager.pluginspec.in src/plugins/qmakeprojectmanager/profileeditorfactory.cpp src/plugins/qmldesigner/QmlDesigner.pluginspec.in src/plugins/qmljseditor/QmlJSEditor.pluginspec.in src/plugins/qmljseditor/qmljseditorfactory.cpp src/plugins/qmljstools/QmlJSTools.pluginspec.in src/plugins/qmlprofiler/QmlProfiler.pluginspec.in src/plugins/qmlprojectmanager/QmlProjectManager.pluginspec.in src/plugins/qnx/Qnx.pluginspec.in src/plugins/qtsupport/QtSupport.pluginspec.in src/plugins/remotelinux/RemoteLinux.pluginspec.in src/plugins/resourceeditor/ResourceEditor.pluginspec.in src/plugins/resourceeditor/resourcewizard.h src/plugins/subversion/Subversion.pluginspec.in src/plugins/tasklist/TaskList.pluginspec.in src/plugins/texteditor/TextEditor.pluginspec.in src/plugins/texteditor/basetexteditor_p.h src/plugins/texteditor/basetextmark.cpp src/plugins/texteditor/codeassist/basicproposalitemlistmodel.h src/plugins/texteditor/codeassist/defaultassistinterface.h src/plugins/texteditor/codeassist/iassistproposalitem.cpp src/plugins/texteditor/itexteditor.cpp src/plugins/texteditor/itexteditor.h src/plugins/texteditor/itextmark.cpp src/plugins/texteditor/plaintexteditor.cpp src/plugins/texteditor/plaintexteditor.h src/plugins/texteditor/texteditoractionhandler.cpp src/plugins/todo/Todo.pluginspec.in src/plugins/updateinfo/UpdateInfo.pluginspec.in src/plugins/valgrind/Valgrind.pluginspec.in src/plugins/vcsbase/VcsBase.pluginspec.in src/plugins/welcome/Welcome.pluginspec.in src/plugins/winrt/WinRt.pluginspec.in tests/auto/debugger/temporarydir.h Change-Id: I254af8be8119fe9855287909e17d4b8ca9d2fc2f
| * License updateEike Ziller2014-10-091-7/+8
| | | | | | | | | | Change-Id: I3c22ef2685d7aa589f5d0ab74d693653a4c32082 Reviewed-by: Alessandro Portale <alessandro.portale@digia.com>
* | Merge remote-tracking branch 'origin/3.2'Eike Ziller2014-09-031-0/+1
|\ \ | |/ | | | | | | | | | | | | | | | | | | | | Conflicts: qtcreator.pri qtcreator.qbs src/plugins/coreplugin/editormanager/editormanager.cpp src/plugins/cppeditor/cppeditor.cpp src/plugins/remotelinux/remotelinuxdebugsupport.cpp src/plugins/texteditor/basetexteditor.cpp Change-Id: I0da7c1cf2506b12d0563795aa8177fc45e97050f
| * C++: set the objectName of QTimers.Erik Verbruggen2014-08-291-0/+1
| | | | | | | | | | | | | | | | | | This will hopefully help a bit in resolving the crashes that happen in QCoreApplication::notifyInternal. Change-Id: Ib3aa8c1a1f50778bd89938d7c529d8399ccf91ea Task-number: QTCREATORBUG-11262 Reviewed-by: Nikolai Kosjar <nikolai.kosjar@digia.com>
* | Cpp{Editor,Tools}: Remove some Qt4-only codeNikolai Kosjar2014-08-281-5/+1
| | | | | | | | | | Change-Id: I94ca7b239e974b6b400933466ee2ef5ae4def336 Reviewed-by: Orgad Shaneh <orgads@gmail.com>
* | Use the functions in QRefCount to check if the QString is in useThiago Macieira2014-07-011-4/+10
|/ | | | | | | | | | | | | QStringLiteral() returns a string that has a refcount of -1 and it must be kept. There is no way to determine if it's still in use, so we'll just assume it is. Any QStringLiteral inserted into the structure will stay there forever. On the other hand, we must not accept unsharable strings, so Q_ASSERT on that. Change-Id: I5fbdc1046f0f00319f27fdfb7aa3ff87371ea668 Reviewed-by: Nikolai Kosjar <nikolai.kosjar@digia.com>
* CppTools: Fix compilation with Qt4Nikolai Kosjar2014-06-021-7/+14
| | | | | | | Change-Id: I76c6ea3557c46fbca4ccb0fb293c6ed6f03e96df Reviewed-by: Orgad Shaneh <orgads@gmail.com> Reviewed-by: Robert Loehning <robert.loehning@digia.com> Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
* C++: use a global string table for SearchSymbols.Erik Verbruggen2014-05-281-0/+116
This string table uniques strings, so that multiple identical strings share their contents. It is used by the locator and the symbol searcher, and will later be used by the class view. Change-Id: Ib8b50f69bbf994d0d7a39b66dc8caf1a3d9bfb42 Reviewed-by: Nikolai Kosjar <nikolai.kosjar@digia.com>