[gnome-shell/wip/carlosg/check-delete-surrounding] inputMethod: Protect for running with older mutter versions
- From: Carlos Garnacho <carlosg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell/wip/carlosg/check-delete-surrounding] inputMethod: Protect for running with older mutter versions
- Date: Sat, 28 Mar 2020 16:29:31 +0000 (UTC)
commit dfbc6a5313e5c7488ffa902ec661500185dba83b
Author: Carlos Garnacho <carlosg gnome org>
Date: Sat Mar 28 17:26:39 2020 +0100
inputMethod: Protect for running with older mutter versions
The offset argument is changing from uint to int. Which means we
might would pass a negative offset and trigger an "out of bounds"
error. Make it work more or less alright with older mutters, by
clamping the offset to 0.
js/misc/inputMethod.js | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
---
diff --git a/js/misc/inputMethod.js b/js/misc/inputMethod.js
index 386c07a75a..d1cb89f7c5 100644
--- a/js/misc/inputMethod.js
+++ b/js/misc/inputMethod.js
@@ -98,7 +98,12 @@ class InputMethod extends Clutter.InputMethod {
}
_onDeleteSurroundingText(_context, offset, nchars) {
- this.delete_surrounding(offset, nchars);
+ try {
+ this.delete_surrounding(offset, nchars);
+ } catch (e) {
+ // We may get out of bounds for negative offset on older mutter
+ this.delete_surrounding(0, nchars);
+ }
}
_onUpdatePreeditText(_context, text, pos, visible) {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]