Fix crash when using the magnifier
The first time that the session is started, it can happen that the AT SPI hasn't been correctly initialized, and this results in a crash when attempting to register the caret or focus listeners. In order to avoid this, these changes check the result of initializing the AT SPI, to allow further attempts when it has failed. https://bugzilla.gnome.org/show_bug.cgi?id=785047
This commit is contained in:
parent
5202181a4d
commit
76c4b0a960
@ -47,30 +47,27 @@ const FocusCaretTracker = new Lang.Class({
|
|||||||
},
|
},
|
||||||
|
|
||||||
_initAtspi: function() {
|
_initAtspi: function() {
|
||||||
if (!this._atspiInited) {
|
if (!this._atspiInited && Atspi.init() == 0) {
|
||||||
Atspi.init();
|
|
||||||
Atspi.set_timeout(250, 250);
|
Atspi.set_timeout(250, 250);
|
||||||
this._atspiInited = true;
|
this._atspiInited = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return this._atspiInited;
|
||||||
},
|
},
|
||||||
|
|
||||||
registerFocusListener: function() {
|
registerFocusListener: function() {
|
||||||
if (this._focusListenerRegistered)
|
if (!this._initAtspi() || this._focusListenerRegistered)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
this._initAtspi();
|
|
||||||
|
|
||||||
this._atspiListener.register(STATECHANGED + ':focused');
|
this._atspiListener.register(STATECHANGED + ':focused');
|
||||||
this._atspiListener.register(STATECHANGED + ':selected');
|
this._atspiListener.register(STATECHANGED + ':selected');
|
||||||
this._focusListenerRegistered = true;
|
this._focusListenerRegistered = true;
|
||||||
},
|
},
|
||||||
|
|
||||||
registerCaretListener: function() {
|
registerCaretListener: function() {
|
||||||
if (this._caretListenerRegistered)
|
if (!this._initAtspi() || this._caretListenerRegistered)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
this._initAtspi();
|
|
||||||
|
|
||||||
this._atspiListener.register(CARETMOVED);
|
this._atspiListener.register(CARETMOVED);
|
||||||
this._caretListenerRegistered = true;
|
this._caretListenerRegistered = true;
|
||||||
},
|
},
|
||||||
|
Loading…
Reference in New Issue
Block a user