Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Marco Bubke
flatpak-qt-creator
Commits
9f967960
Commit
9f967960
authored
Jul 19, 2010
by
Erik Verbruggen
Committed by
con
Jul 19, 2010
Browse files
Fixed crash while renaming symbol when a symbol is being renamed.
Task-number: QTCREATORBUG-1770 (cherry picked from commit
4dffc2aa
)
parent
21ac8dcc
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/plugins/cppeditor/cppeditor.cpp
View file @
9f967960
...
...
@@ -605,7 +605,7 @@ CPPEditorEditable::CPPEditorEditable(CPPEditor *editor)
CPPEditor
::
CPPEditor
(
QWidget
*
parent
)
:
TextEditor
::
BaseTextEditor
(
parent
)
,
m_currentRenameSelection
(
-
1
)
,
m_currentRenameSelection
(
NoCurrentRenameSelection
)
,
m_inRename
(
false
)
,
m_inRenameChanged
(
false
)
,
m_firstRenameChange
(
false
)
...
...
@@ -712,7 +712,7 @@ void CPPEditor::createToolBar(CPPEditorEditable *editable)
void
CPPEditor
::
paste
()
{
if
(
m_currentRenameSelection
==
-
1
)
{
if
(
m_currentRenameSelection
==
NoCurrentRenameSelection
)
{
BaseTextEditor
::
paste
();
return
;
}
...
...
@@ -724,7 +724,7 @@ void CPPEditor::paste()
void
CPPEditor
::
cut
()
{
if
(
m_currentRenameSelection
==
-
1
)
{
if
(
m_currentRenameSelection
==
NoCurrentRenameSelection
)
{
BaseTextEditor
::
cut
();
return
;
}
...
...
@@ -772,10 +772,10 @@ void CPPEditor::finishRename()
void
CPPEditor
::
abortRename
()
{
if
(
m_currentRenameSelection
<
0
)
if
(
m_currentRenameSelection
<
=
NoCurrentRenameSelection
)
return
;
m_renameSelections
[
m_currentRenameSelection
].
format
=
m_occurrencesFormat
;
m_currentRenameSelection
=
-
1
;
m_currentRenameSelection
=
NoCurrentRenameSelection
;
m_currentRenameSelectionBegin
=
QTextCursor
();
m_currentRenameSelectionEnd
=
QTextCursor
();
setExtraSelections
(
CodeSemanticsSelection
,
m_renameSelections
);
...
...
@@ -986,7 +986,7 @@ void CPPEditor::onContentsChanged(int position, int charsRemoved, int charsAdded
{
Q_UNUSED
(
position
)
if
(
m_currentRenameSelection
==
-
1
||
m_inRename
)
if
(
m_currentRenameSelection
==
NoCurrentRenameSelection
||
m_inRename
)
return
;
if
(
position
+
charsAdded
==
m_currentRenameSelectionBegin
.
position
())
{
...
...
@@ -1125,7 +1125,7 @@ void CPPEditor::updateUses()
void
CPPEditor
::
updateUsesNow
()
{
if
(
m_currentRenameSelection
!=
-
1
)
if
(
m_currentRenameSelection
!=
NoCurrentRenameSelection
)
return
;
semanticRehighlight
();
...
...
@@ -1735,7 +1735,7 @@ bool CPPEditor::event(QEvent *e)
{
switch
(
e
->
type
())
{
case
QEvent
::
ShortcutOverride
:
if
(
static_cast
<
QKeyEvent
*>
(
e
)
->
key
()
==
Qt
::
Key_Escape
&&
m_currentRenameSelection
!=
-
1
)
{
if
(
static_cast
<
QKeyEvent
*>
(
e
)
->
key
()
==
Qt
::
Key_Escape
&&
m_currentRenameSelection
!=
NoCurrentRenameSelection
)
{
e
->
accept
();
return
true
;
}
...
...
@@ -1801,7 +1801,7 @@ void CPPEditor::contextMenuEvent(QContextMenuEvent *e)
void
CPPEditor
::
keyPressEvent
(
QKeyEvent
*
e
)
{
if
(
m_currentRenameSelection
==
-
1
)
{
if
(
m_currentRenameSelection
==
NoCurrentRenameSelection
)
{
TextEditor
::
BaseTextEditor
::
keyPressEvent
(
e
);
return
;
}
...
...
@@ -2006,6 +2006,7 @@ void CPPEditor::updateSemanticInfo(const SemanticInfo &semanticInfo)
QList
<
QTextEdit
::
ExtraSelection
>
unusedSelections
;
m_renameSelections
.
clear
();
m_currentRenameSelection
=
NoCurrentRenameSelection
;
SemanticInfo
::
LocalUseIterator
it
(
semanticInfo
.
localUses
);
while
(
it
.
hasNext
())
{
...
...
src/plugins/cppeditor/cppeditor.h
View file @
9f967960
...
...
@@ -292,6 +292,7 @@ private:
QList
<
QTextEdit
::
ExtraSelection
>
m_renameSelections
;
int
m_currentRenameSelection
;
static
const
int
NoCurrentRenameSelection
=
-
1
;
bool
m_inRename
,
m_inRenameChanged
,
m_firstRenameChange
;
QTextCursor
m_currentRenameSelectionBegin
;
QTextCursor
m_currentRenameSelectionEnd
;
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment