Commit Graph

107 Commits

Author SHA1 Message Date
Nikolai Kosjar
c6358e5d38 C++: Add utf16 indices to Macro and Document::MacroUse
In most cases we need to work with the utf16 indices. Only in
cppfindreferences the byte interface is still needed since there we read
in files and work on a QByteArray to save memory.

Change-Id: I6ef6a93fc1875a8c9a305c075d51a9ca034c41bb
Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
2014-05-23 14:34:01 +02:00
Nikolai Kosjar
3f835d3925 CppTools: Fix race conditions in CppEditorSupport
...when accessing m_lastSemanticInfo by introducing semanticInfo() and
setSemanticInfo(), which lock the appropriate mutex.

Task-number: QTCREATORBUG-11367
Change-Id: If8ac6b8e6d576dfd1869c98a7ff7952ec97f530e
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
Reviewed-by: Eike Ziller <eike.ziller@digia.com>
2014-04-30 14:28:34 +02:00
Nikolai Kosjar
9b2672cb05 CppTools: Fix data race when accessing the editor revision
Addresses the following findings of QTCREATORBUG-12030:
 * qtc.helgrind.plugintests.txt#2
 * qtc.helgrind.usingEditors1.txt#1

Helgrind report (truncated):

Possible data race during write of size 4 at 0x23679618 by thread #1
Locks held: none
   at 0x6819003: ???
   by 0x681D713: ???
   by 0x68200DE: ???
   by 0x684B8F8: QTextCursor::insertText(QString const&, QTextCharFormat const&)
   by 0x684BCB9: QTextCursor::insertText(QString const&)
   by 0x139DA06C: TextEditor::BaseTextEditorWidget::keyPressEvent(QKeyEvent*) (basetexteditor.cpp:1866)
   by 0x184C999F: CppEditor::Internal::CPPEditorWidget::keyPressEvent(QKeyEvent*) (cppeditor.cpp:1416)

This conflicts with a previous read of size 4 by thread #18
Locks held: none
   at 0x680BC54: QTextDocument::revision() const
   by 0x159047F3: CppTools::CppEditorSupport::editorRevision() const (cpptoolseditorsupport.cpp:198)
   by 0x158E39BF: CppTools::Internal::CppModelManager::buildWorkingCopyList() (cppmodelmanager.cpp:525)
   by 0x158E3D5B: CppTools::Internal::CppModelManager::workingCopy() const (cppmodelmanager.cpp:544)
   by 0x1589FF6F: CppTools::Internal::CppCompletionAssistInterface::getCppSpecifics() const (cppcompletionassist.cpp:1957)
   by 0x158A1158: CppTools::Internal::CppCompletionAssistInterface::snapshot() const (cppcompletionassist.h:200)
   by 0x1589707C: CppTools::Internal::CppCompletionAssistProcessor::startCompletionInternal(QString, unsigned int, unsigned int, QString const&, int) (cppcompletionassist.cpp:1212)
   by 0x15893CC7: CppTools::Internal::CppCompletionAssistProcessor::startCompletionHelper() (cppcompletionassist.cpp:970)

---

Possible data race during write of size 4 at 0x24C8AD18 by thread #1
Locks held: none
   at 0x684AF23: QTextCursor::beginEditBlock()
   by 0x139D7D05: TextEditor::BaseTextEditorWidget::keyPressEvent(QKeyEvent*) (basetexteditor.cpp:1578)
   by 0x184C999F: CppEditor::Internal::CPPEditorWidget::keyPressEvent(QKeyEvent*) (cppeditor.cpp:1416)
   ...
   by 0x40F15A: main (main.cpp:533)

This conflicts with a previous read of size 4 by thread #11
Locks held: none
   at 0x680BC54: QTextDocument::revision() const
   by 0x159048D3: CppTools::CppEditorSupport::editorRevision() const (cpptoolseditorsupport.cpp:198)
   by 0x158E3A9F: CppTools::Internal::CppModelManager::buildWorkingCopyList() (cppmodelmanager.cpp:525)
   by 0x158E3E3B: CppTools::Internal::CppModelManager::workingCopy() const (cppmodelmanager.cpp:544)
   by 0x1590741E: parse(QFutureInterface<void>&, QSharedPointer<CppTools::SnapshotUpdater>) (cpptoolseditorsupport.cpp:299)

Task-number: QTCREATORBUG-12030
Change-Id: Idf0aa47f1f6bfd6814a961fe39d3b19b98f934f5
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
2014-04-14 10:29:57 +02:00
Nikolai Kosjar
291b80cb33 CppTools: Remove invalid optimization for highlighting
The optimization in question could lead to an empty source and thus to
no highlighting. Checking for 'force' and the revisions is at this point
not enough since later the semantic info calculcation can be aborted, so
that a subsequent recalculation would get an empty document.

contents() itself is already optimized (uses caching).

Task-number: QTCREATORBUG-11367
Change-Id: If31a8ab0c848e4babd38104961fb9812f077a2be
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
2014-04-14 10:28:37 +02:00
Nikolai Kosjar
e7904caf0b CppTools: Do not wait in GUI thread for the parsed document
...when collecting data for the semantic highlighting recalculation.

Task-number: QTCREATORBUG-11037

Change-Id: Ibed73a2916df0a91aedef166de2c8c6bb5df309c
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
2014-04-14 10:27:53 +02:00
Nikolai Kosjar
ec13e65d95 CppTools: Avoid using old incomplete semantic info document
Task-number: QTCREATORBUG-11367
Change-Id: I8b02c30a43a57c547bc07d796f4b29725beca793
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
Reviewed-by: Eike Ziller <eike.ziller@digia.com>
2014-04-11 16:22:47 +02:00
Nikolai Kosjar
cbf98ba819 CppEditor: Allow force highlighting if using clang
...so we can rehighlight if it's requested by the editor. This is e.g.
necessary if the font size changes.

Task-number: QTCREATORBUG-11502
Change-Id: I608921899fc37fcf1394db9ff041e6b378196bdd
Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
2014-03-17 14:39:50 +01:00
Nikolai Kosjar
18e6be55d7 CppTools: Tag incomplete semantic info
...in order to be able to full-rehighlight on the next turn.

The following sequence was problematic:

1. recalculateSemanticInfoDetached(true)
   * e.g. triggered by opening the document
2. recalculateSemanticInfoDetached(false)
   * e.g. triggered by moving the cursor
   * cancels 1. and leads to incompletely parsed/checked document - OK
3. startHighlighting()
   * triggered by 1.; starts highlighting on incomplete document - OK
4. startHighlighting()
   * gets a completely parsed/checked document - OK
   * not forced, so just compare revisions; they are the same, so
     skip/return - a partly highlighted document is left behind.

Task-number: QTCREATORBUG-11367
Change-Id: Ic56e00e862ec4a1ffa197b2fc8b48be56a3562de
Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
2014-03-17 14:39:19 +01:00
Nikolai Kosjar
1f0fd959fa CppEditor: Do not cancel highlighter on user interaction
e.g. changing cursor position or editing text.

CPPEditorWidget::updateUses() does not depend on the highlighter, but
only on the semantic info update.

Task-number: QTCREATORBUG-11367
Change-Id: Ia9f5ed7c2adc6899995a5d966a20e45b2f87d9e3
Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
2014-03-17 14:38:32 +01:00
Nikolai Kosjar
349de9331c C++: Fix weird logic in usage of TopLevelDeclarationProcessor::processDeclaration
As the name function name suggests, true should be returned if the
declaration should be processed. Otherwise false.

Change-Id: I8d266d99c579b331fee8772bde47aa1a466dae9c
Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
2014-03-13 15:41:01 +01:00
Nikolai Kosjar
8f6b4c784d CppTools: Remove useless parameter in recalculateSemanticInfo()
Change-Id: I24b6f6d698051d1ccfe3f0d83078c26d8de193fb
Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
2014-03-13 15:40:07 +01:00
Eike Ziller
b5be4d2866 CppEditor: Fix missing semantic highlighting
In case the editor is hidden before semantic highlighting started
(because semantic parsing hasn't finished yet).
Just disable the logic that tries to optimize that for now, since it is
not working, and fixing it will require more work (that's done later
anyhow).

Task-number: QTCREATORBUG-11367
Change-Id: I7ef3cc558e514968f90d2ea56b2df362606d879a
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@digia.com>
2014-02-18 11:55:35 +01:00
Eike Ziller
db897f8146 Fix build on Windows
For some reason it doesn't like signals with QFutures. Going back to
pointers, but copying the future from there when it's used.

Change-Id: I8dea0817b4e59ede6874ab8be01f22a92e7402a0
Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
2014-02-06 10:49:04 +01:00
Erik Verbruggen
58af02f074 C++: release more futures.
The CPPEditorWidget retained two futures, as did the attached future
watchers retained them too. Together, each future and the watcher held
on to a complete snapshot that would only get released when another
future was set. This could result into retaining old snapshots in
editors that were invisible/unused for long.

Change-Id: I1133e857c620437b4a69b9dad468f6bd458304b8
Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
2014-02-05 15:42:46 +01:00
Thiago Macieira
f1606a9f58 Normalize signal & slot signatures in connection
Profiling shows Qt Creator spends 2% of its load time normalizing

Change-Id: I7c38825875c8db58813792dcb86b3a88945466f7
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
Reviewed-by: Christian Kandeler <christian.kandeler@digia.com>
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
2014-02-03 20:19:44 +01:00
Eike Ziller
cec4fac873 CppEditor: Fix semantic highlighting after "Save as"
Change-Id: I523735bae9e1a19678d4ab697c1edce2886bedeb
Reviewed-by: Eike Ziller <eike.ziller@digia.com>
2014-01-14 09:04:14 +01:00
Eike Ziller
cfad9bdc3c TextEditors: Move contentsChanged signal from editor to document
Change-Id: Ic935a8971705cb3238deda71aa2b5d19e4f62593
Reviewed-by: Eike Ziller <eike.ziller@digia.com>
2014-01-14 09:03:58 +01:00
Eike Ziller
236ea9efb9 Merge remote-tracking branch 'origin/3.0'
Conflicts:
	share/qtcreator/debugger/dumper.cpp
	share/qtcreator/debugger/dumper_p.h
	share/qtcreator/debugger/test/main.cpp
	src/plugins/debugger/gdb/classicgdbengine.cpp
	src/plugins/debugger/gdb/pythongdbengine.cpp
	src/plugins/debugger/lldblib/guest/lldbengineguest.cpp
	src/plugins/debugger/lldblib/guest/lldbengineguest.h
	src/plugins/debugger/lldblib/guest/main.cpp
	src/plugins/debugger/lldblib/ipcengineguest.cpp
	src/plugins/debugger/lldblib/ipcengineguest.h
	src/plugins/debugger/lldblib/ipcenginehost.cpp
	src/plugins/debugger/lldblib/ipcenginehost.h
	src/plugins/debugger/lldblib/lldbenginehost.cpp
	src/plugins/debugger/lldblib/lldboptionspage.cpp
	src/plugins/qbsprojectmanager/qbsstep.cpp
	src/plugins/qbsprojectmanager/qbsstep.h
	src/plugins/qmlprofiler/canvas/qdeclarativecanvas.cpp
	src/plugins/qmlprofiler/canvas/qdeclarativecanvas_p.h
	src/plugins/qmlprofiler/canvas/qdeclarativecontext2d.cpp
	src/plugins/qmlprofiler/canvas/qdeclarativecontext2d_p.h
	src/plugins/qmlprofiler/canvas/qmlprofilercanvas.cpp
	src/plugins/qnx/blackberrycheckdevmodestep.cpp
	src/plugins/qtsupport/debugginghelper.cpp

Change-Id: Ie9fd0a885fb6264a6a8a72daee071b75bcbd2e9d
2014-01-08 11:01:06 +01:00
Robert Loehning
746c5d8863 Incremented year in copyright info
Change-Id: Ib5423fdd064e4546f848c0b640b0ed0514c26d3a
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@digia.com>
Reviewed-by: Kai Koehne <kai.koehne@digia.com>
2014-01-08 08:29:47 +01:00
Eike Ziller
5aa8a63f90 CppEditor: Fix potential crash
The m_snapshotUpdater may never be accessed directly.

Change-Id: Id773a291f66e93a48ae46f2b1c04417af2f26763
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@digia.com>
2014-01-07 12:22:30 +01:00
Friedemann Kleint
dc6b28366c Avoid value-list creation when iterating over maps.
Change-Id: I704ba93d01ffababb405bc801f07a845631930cc
Reviewed-by: Daniel Teske <daniel.teske@digia.com>
2013-12-16 16:03:16 +01:00
Eike Ziller
890f72160c Rename QString ITextEditorDocument::contents --> plainText
To differentiate it from the byte array based IDocument::setContents

Change-Id: Icc9600732c2742fb79254a0697870bacce3a59ee
Reviewed-by: David Schulz <david.schulz@digia.com>
2013-12-10 09:11:30 +01:00
Erik Verbruggen
af2900ce72 C++: prevent possibly highlighting a document twice
Possible when the highlighter does not need semantic info to run, and is
started through onDocumentUpdated() and updateDocumentNow().

Change-Id: I720299730213ac196143a273fb60cee8e43111f1
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@digia.com>
2013-12-04 10:40:02 +01:00
Nikolai Kosjar
067ae2439b CppTools: Fix crash on shutdown
We need to wait for the document parser, otherwise the CppModelManager
object might get destroyed first and will be referenced later in
CppEditorSupport::parse().

Change-Id: I1b591640c1da3e63e49ac0b4b8af41aae31b3d43
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
2013-11-20 11:30:12 +01:00
Nikolai Kosjar
3b5e84e650 CppTools: Fix race condition when closing files
If parse() is called in another thread the CppToolsEditorSupport might be
already destructed.

Task-number: QTCREATORBUG-10548

Change-Id: Ie4215937eb1847b51bce8b080aca4925c0bee39f
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
2013-11-19 13:12:00 +01:00
Nikolai Kosjar
d8077db3fb CppTools: Fix crash for documents without file paths
Since commit 566be09 we might reparse the current document if the
current editor changes. This is fine as long as the current document has
a file path, which is not always true, especially for the documents
created in the FakeVim tests.

Task-number: QTCREATORBUG-10767
Change-Id: Ibe00ef8bb6a144e2ba09b311025d238c2dcde112
Reviewed-by: Christian Stenger <christian.stenger@digia.com>
Reviewed-by: hjk <hjk121@nokiamail.com>
2013-11-14 11:21:26 +01:00
Nikolai Kosjar
36ce1dbb84 Designer/CppTools: Fix flaky test_gotoslot_withoutProject
The document was not always updated in time.

Change-Id: Iac89985d39a8784e3cbf63dfd42b1c5150775068
Reviewed-by: Christian Stenger <christian.stenger@digia.com>
2013-11-14 08:34:45 +01:00
Erik Verbruggen
566be0995d C++: Release more documents.
- fix memory leak in find-usages
- do not retain snapshot in search history
- when an editor is invisible for more than 2 minutes, release the
  backing snapshot

Retaining snapshots will retain their documents, and if done for too
long, the memory consumption might grow. This is especially the case
when switching to a different kit (Qt version): in that case, the new
versions of headers will be indexed, while the old ones stay around.

Task-number: QTCREATORBUG-5583
Task-number: QTCREATORBUG-7645
Task-number: QTCREATORBUG-9842

Change-Id: I045eda1565e0a3fa702baeffaab9c12662f90289
Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@digia.com>
2013-11-12 09:24:13 +01:00
Nikolai Kosjar
b8dbac0b9c Rename "[Mm]ethod(s)" to "[Ff]unction(s)"
Only methods as programming functions are affected. Besides renaming
some actions like "Switch Between Function Declaration/Definition" this
mostly touches (api) code comments.

This is a follow-up patch to commit 872bfb7.

Change-Id: Icb65e8d73b59a022f8885b14df497169543a3b92
Reviewed-by: hjk <hjk121@nokiamail.com>
2013-10-10 15:56:12 +02:00
Nikolai Kosjar
cd4c4218e4 CppTools: Fix completion in other editor
On duplication of an editor onMimeTypeChanged() of CppToolsEditorSupport
was not triggered, thus not completion provider was set.

Task-number: QTCREATORBUG-10284

Change-Id: Ia1da7f59b19e042f65b068a993f0d5c04b0778e0
Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
2013-10-02 12:13:31 +02:00
Erik Verbruggen
507452f097 CppTools: honor pre-compiled headers in the code-model.
Task-number: QTCREATORBUG-476

Change-Id: I82ed92acdcda551d2c6a9ca221832ac20117a08f
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@digia.com>
2013-10-01 13:02:45 +02:00
Orgad Shaneh
e4f762deec Fix compilation with Qt4
Change-Id: I486198c9d7e27159445411c38037d315b90cd67a
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@digia.com>
2013-10-01 12:40:15 +02:00
Erik Verbruggen
ba2d7a4fa7 C++: Only parse with appropriate defines for open editors.
If two files from different (sub-)projects include the same header file,
and the defined macros differ for both files, the header file will be
parsed with only the appropriate macros for the including file.

Task-number: QTCREATORBUG-9802
Task-number: QTCREATORBUG-1249

Change-Id: I560490afa287b3bb1e863bce1bb4f57af36ad56e
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@digia.com>
2013-10-01 10:33:51 +02:00
Nikolai Kosjar
87e793d089 CppTools: Initialize pointer to 0
Change-Id: I55ec2d98b5fe72936ae7073e211fc6297334daba
Reviewed-by: Fawzi Mohamed <fawzi.mohamed@digia.com>
2013-09-11 15:47:49 +02:00
Erik Verbruggen
f7c68f6baf C++: change working-copy to work on UTF-8 encoded QByteArrays.
These not only take less space than UTF-16 encoded QStrings, but due to
the caching in the CppEditorSupport also take less time to build.

This patch also fixes a number of possible encoding issues, where files
and constant strings were (falsely) assumed to be UTF-8.

Change-Id: Ib6f91c9a94ebed5b5dfbd4eb2998825c62c72784
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@digia.com>
Reviewed-by: hjk <hjk121@nokiamail.com>
2013-09-11 09:43:14 +02:00
Erik Verbruggen
b4a1bd415f C++: clean-up CppCompletionAssist.
This is step 1 of 2 for merging the various provider factories into a
single class. Merging has the advantage that selecting based on editor
(content) mime-type only has to select one class, instead of re-doing
the selection for each class separately.

Change-Id: I11f815151bd4769ae6028b636793d6a80d02e202
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@digia.com>
2013-09-09 11:59:14 +02:00
Erik Verbruggen
7516ef4969 TextEditor: get CompletionAssistProvider from editor.
And not from the global object pool. This way, the editors that have
different highlighters for various language dialects, or editors that
support multiple languages in a single editor, can decide themselves on
what CompletionAssistProvider to provide.

Change-Id: Ieebc4a8e7b3de6470fdb8103035aa3b8b2ba6598
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@digia.com>
2013-09-09 10:15:55 +02:00
hjk
4a24df38a3 EditorManager: Use static pattern, adjust surrounding code
Change-Id: I3255a0150cd9a730336456c5a9f986eb74fefbff
Reviewed-by: Tobias Hunger <tobias.hunger@digia.com>
2013-08-30 11:22:56 +02:00
Erik Verbruggen
073e5d6632 C++: optionally let the highlighter handle ifdefed-out blocks.
Change-Id: I38cc0e55348cac0245d2ab8f3e39c68de76e3e6d
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@digia.com>
2013-08-19 13:01:07 +02:00
Nikolai Kosjar
e2ce17ef00 CppTools: Fix "! condition" coding style
Change-Id: Ic7e634e4249fb64edbc2daceb65ec8e9b5f0f8b9
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
Reviewed-by: Aurindam Jana <aurindam.jana@digia.com>
2013-07-25 13:11:34 +02:00
Orgad Shaneh
ad9e7ccab6 Fix coding style for else statements
Change-Id: I1309db70e98d678e150388c76ce665e988fdf081
Reviewed-by: Eike Ziller <eike.ziller@digia.com>
2013-07-17 11:11:25 +02:00
Eike Ziller
dd43d9908f Rename IDocument::fileName --> filePath
That is what it actually is, wrt how Qt API calls it.

Change-Id: Ied02055debf6aad75556b0d9d22e8ba2f72be555
Reviewed-by: Eike Ziller <eike.ziller@digia.com>
2013-07-09 13:51:42 +02:00
Nikolai Kosjar
6df66e883f CppTools: Do not hand over partly reloaded files to the code model
When a reloading operation was in progress, CppEditorSupport::contents()
could return a partly reloaded file to the code model leading to parse
errors and incomplete highlighting.

Fixed by checking if the file is currently being reloaded.

Task-number: QTCREATORBUG-9382

Change-Id: Iee97e10444763c0cbf481132afa4617c5cdbd15c
Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
2013-06-24 11:13:35 +02:00
Nikolai Kosjar
5cb22e5021 CppEditor: Fix highlighting in new split if file is changed externally
For a new split/editor no CppHighlightingSupport was set since
onMimeTypeChanged was not called.

Now the CppHighlightingSupport is set again in the constructor. This
reverts partly

    commit 033ad887
    C++: handle file type changes for choosing highlighters

Task-number: QTCREATORBUG-9382
Change-Id: Ie79d357d570bec4920366fbd56fb67859be9b37a
Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
2013-06-17 10:36:39 +02:00
Erik Verbruggen
033ad8875b C++: handle file type changes for choosing highlighters.
If the file type (mime type) of an editor changes, it might need a
different kind of highlighter/highlighting-support.

Change-Id: I470dbf69e71856c9593d201416c4d4bd2958aaec
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@digia.com>
2013-05-15 15:05:58 +02:00
Nikolai Kosjar
934cea560d CppEditor: Fix crash when closing editors fast
Task-number: QTCREATORBUG-9250

Change-Id: I15bcaf5d0e55c7e3cc731755fc48df2d1181f3da
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
2013-05-08 10:29:10 +02:00
Nikolai Kosjar
5b30509a99 CppEditor: Fix highlighting if there are unconfigured projects
If Creator switched to the Project mode on startup, the highlighting was
not started because the editor widget was not visible. Now we check if
the editor itself is or would be visible in the edit mode, which is
indepedent of the current mode.

Task-number: QTCREATORBUG-9260
Change-Id: I72373e09965fd1cded034ae4711df48798e7f0d8
Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
2013-05-07 11:45:59 +02:00
Nikolai Kosjar
cacd66195c CppEditor: Avoid premature calls to recalculateSemanticInfoNow
Now recalculateSemanticInfoNow is called only once instead of three
times when a new editor is opened/created.

Change-Id: Ife84fc9ca90cdbf2a417123e6a2b9e1e068dfdc4
Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
2013-05-07 11:45:46 +02:00
Nikolai Kosjar
7313203c29 CppEditor: Reduce calls to recalculateSemanticInfo()
Case: Opening a file that is not yet in the Snapshot

recalculateSemanticInfoNow() emitted the same SemanticInfo until the
indexer processed the document (Snapshot::contains()). That signal
caused CppEditorWidget::updateSemanticInfo() to call
semanticRehighlight() because of unequal revisions. That triggered
recalculateSemanticInfo() again.

Change-Id: I8fb7d7c42aad3d6a89876e743cd4e3c7aff643bf
Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
2013-05-07 11:43:53 +02:00
Erik Verbruggen
364c95476e C++: fix possible null-pointer derefs.
Change-Id: Ie6a2398f3a9e5c26a9af1578e512da53a01d15f5
Reviewed-by: Sergey Shambir <sergey.shambir.auto@gmail.com>
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@digia.com>
2013-05-03 08:41:13 +02:00