summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2023-01-24 12:33:45 +0000
committerMichael Stahl <michael.stahl@allotropia.de>2023-02-02 11:29:14 +0000
commitc1b14f94ca800577eb79eec3cc69b764017a6e25 (patch)
tree32b780b0ecf77aeb39b285dd7005e8e2ee93c8a1
parent7a6cbff566122113b753fd31e7c73be8725f48f2 (diff)
tdf#152404 crash with ibus-mozc with ctrl+alt+c during ExtTextInput
Change-Id: I86e19387d93a57c3ad263f0c2dc9222a5f3480be Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146078 Tested-by: Jenkins Reviewed-by: Michael Stahl <michael.stahl@allotropia.de>
-rw-r--r--vcl/unx/gtk3/gtkframe.cxx10
-rw-r--r--vcl/win/window/salframe.cxx4
2 files changed, 12 insertions, 2 deletions
diff --git a/vcl/unx/gtk3/gtkframe.cxx b/vcl/unx/gtk3/gtkframe.cxx
index 864e8934c7ad..1d72e46ff21a 100644
--- a/vcl/unx/gtk3/gtkframe.cxx
+++ b/vcl/unx/gtk3/gtkframe.cxx
@@ -451,6 +451,16 @@ bool GtkSalFrame::doKeyCallback( guint state,
bool bStopProcessingKey;
if (bDown)
{
+ // tdf#152404 Commit uncommitted text before dispatching key shortcuts. In
+ // certain cases such as pressing Control-Alt-C in a Writer document while
+ // there is uncommitted text will call GtkSalFrame::EndExtTextInput() which
+ // will dispatch a SalEvent::EndExtTextInput event. Writer's handler for that
+ // event will delete the uncommitted text and then insert the committed text
+ // but LibreOffice will crash when deleting the uncommitted text because
+ // deletion of the text also removes and deletes the newly inserted comment.
+ if (m_pIMHandler && !m_pIMHandler->m_aInputEvent.maText.isEmpty() && (aEvent.mnCode & (KEY_MOD1 | KEY_MOD2)))
+ m_pIMHandler->doCallEndExtTextInput();
+
bStopProcessingKey = CallCallbackExc(SalEvent::KeyInput, &aEvent);
// #i46889# copy AlternateKeyCode handling from generic plugin
if (!bStopProcessingKey)
diff --git a/vcl/win/window/salframe.cxx b/vcl/win/window/salframe.cxx
index 6a7eecdb71b1..dc804a76ab35 100644
--- a/vcl/win/window/salframe.cxx
+++ b/vcl/win/window/salframe.cxx
@@ -3424,8 +3424,8 @@ static void UnsetAltIfAltGr(SalKeyEvent& rKeyEvt, sal_uInt16 nModCode)
}
// tdf#152404 Commit uncommitted text before dispatching key shortcuts. In
-// certain cases such as pressing Command-Option-C in a Writer document while
-// there is uncommitted text will call AquaSalFrame::EndExtTextInput() which
+// certain cases such as pressing Control-Alt-C in a Writer document while
+// there is uncommitted text will call WinSalFrame::EndExtTextInput() which
// will dispatch a SalEvent::EndExtTextInput event. Writer's handler for that
// event will delete the uncommitted text and then insert the committed text
// but LibreOffice will crash when deleting the uncommitted text because