summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorTakumi ASAKI <takumi.asaki@nokia.com>2011-11-17 15:26:05 (GMT)
committerOswald Buddenhagen <oswald.buddenhagen@nokia.com>2011-11-17 15:26:05 (GMT)
commitb68b59f252930538cc124b31decc990ab57bea20 (patch)
treec1a9e2d9d705446246d1fff8d4cd46fa270a828b /tools
parentff8486f8326e214faa08eacc8e91b5333d68e912 (diff)
downloadQt-b68b59f252930538cc124b31decc990ab57bea20.zip
Qt-b68b59f252930538cc124b31decc990ab57bea20.tar.gz
Qt-b68b59f252930538cc124b31decc990ab57bea20.tar.bz2
Qt Linguist: Fix crash after select 2nd translation in lengthvariant
* MessageEditor keeps deleted editor as m_selectionHolder. QOjbect::destroyed() SIGNAL doesn't fit to fix this problem due to destruction order problem. Merge-request: 1466 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@nokia.com>
Diffstat (limited to 'tools')
-rw-r--r--tools/linguist/linguist/messageeditor.cpp7
-rw-r--r--tools/linguist/linguist/messageeditor.h1
-rw-r--r--tools/linguist/linguist/messageeditorwidgets.cpp4
-rw-r--r--tools/linguist/linguist/messageeditorwidgets.h1
4 files changed, 12 insertions, 1 deletions
diff --git a/tools/linguist/linguist/messageeditor.cpp b/tools/linguist/linguist/messageeditor.cpp
index 6cafe8e..87c2f4a 100644
--- a/tools/linguist/linguist/messageeditor.cpp
+++ b/tools/linguist/linguist/messageeditor.cpp
@@ -262,6 +262,7 @@ void MessageEditor::addPluralForm(int model, const QString &label, bool writable
{
FormMultiWidget *transEditor = new FormMultiWidget(label);
connect(transEditor, SIGNAL(editorCreated(QTextEdit*)), SLOT(editorCreated(QTextEdit*)));
+ connect(transEditor, SIGNAL(editorDeleted(QTextEdit*)), SLOT(editorDeleted(QTextEdit*)));
transEditor->setEditingEnabled(writable);
transEditor->setHideWhenEmpty(!writable);
if (!m_editors[model].transTexts.isEmpty())
@@ -298,6 +299,12 @@ void MessageEditor::editorCreated(QTextEdit *te)
}
}
+void MessageEditor::editorDeleted(QTextEdit *te)
+{
+ if (m_selectionHolder == te)
+ resetSelection();
+}
+
void MessageEditor::fixTabOrder()
{
m_tabOrderTimer.start(0);
diff --git a/tools/linguist/linguist/messageeditor.h b/tools/linguist/linguist/messageeditor.h
index 4686d3d..21b3405 100644
--- a/tools/linguist/linguist/messageeditor.h
+++ b/tools/linguist/linguist/messageeditor.h
@@ -114,6 +114,7 @@ public slots:
private slots:
void editorCreated(QTextEdit *);
+ void editorDeleted(QTextEdit *);
void selectionChanged(QTextEdit *);
void resetHoverSelection();
void emitTranslationChanged(QTextEdit *);
diff --git a/tools/linguist/linguist/messageeditorwidgets.cpp b/tools/linguist/linguist/messageeditorwidgets.cpp
index 6422b47..29df673 100644
--- a/tools/linguist/linguist/messageeditorwidgets.cpp
+++ b/tools/linguist/linguist/messageeditorwidgets.cpp
@@ -362,9 +362,11 @@ void FormMultiWidget::setTranslation(const QString &text, bool userAction)
QStringList texts = text.split(QChar(Translator::BinaryVariantSeparator), QString::KeepEmptyParts);
while (m_editors.count() > texts.count()) {
+ FormatTextEdit *editor = m_editors.takeLast();
+ emit editorDeleted(editor);
delete m_minusButtons.takeLast();
delete m_plusButtons.takeLast();
- delete m_editors.takeLast();
+ delete editor;
}
while (m_editors.count() < texts.count())
addEditor(m_editors.count());
diff --git a/tools/linguist/linguist/messageeditorwidgets.h b/tools/linguist/linguist/messageeditorwidgets.h
index cb24377..1f6f1f5 100644
--- a/tools/linguist/linguist/messageeditorwidgets.h
+++ b/tools/linguist/linguist/messageeditorwidgets.h
@@ -150,6 +150,7 @@ public:
signals:
void editorCreated(QTextEdit *);
+ void editorDeleted(QTextEdit *);
void textChanged(QTextEdit *);
void selectionChanged(QTextEdit *);
void cursorPositionChanged();