Skip to content

Prevent a single faulty ScriptableObject from breaking script handling altogether (#5446)#11166

Merged
feerrenrut merged 5 commits into
nvaccess:masterfrom
accessolutions:i5446-superInit
Jun 11, 2020
Merged

Prevent a single faulty ScriptableObject from breaking script handling altogether (#5446)#11166
feerrenrut merged 5 commits into
nvaccess:masterfrom
accessolutions:i5446-superInit

Conversation

@JulienCochuyt

@JulienCochuyt JulienCochuyt commented May 14, 2020

Copy link
Copy Markdown
Contributor

Link to issue number:

Fixes #5446

Summary of the issue:

Currently, if ScriptableObject.getScript raises an exception, the whole scriptHandler.findScript fails, and InputManager.executeGesture fails with it.

The sooner the incriminated ScriptableObject is looked upon during scriptHandler.findScript, the most blocking is the result.
A common example is missing to call super().__init__ in a GlobalPlugin, but other scenarios could easily be encountered as well in other dynamic script binding situations.

This issue typically strikes beginner blind developers, and I guess we especially don't want to harden the path for them, notably because many of us walked it before.

Description of how this pull request fixes the issue:

  • In scriptHandler.findScript, catch any exception thrown by ScriptableObject.getScript, log the error, but keep on processing.
  • In ScriptableObject.getScript, catch the AttributeError emitted when accessing self._gestureMap with an uninitialized base class and log an informative diagnostic message.

Testing performed:

Tested with a GlobalPlugin that misses to initialize its base class.
Checks that errors are logged, but NVDA keeps functioning normally.

Known issues with pull request:

Change log entry:

Section: Changes for developers
A broken ScriptableObject - such as a GlobalPlugin missing to call the __init__ method of its base class - does not break anymore NVDA's script handling altogether.

@LeonarddeR

Copy link
Copy Markdown
Collaborator

I guess this does not fit well in the existing change log sections, as the bug it fixes mostly affects developers.

Therefore, I think changes for developers fits.

Comment thread source/scriptHandler.py Outdated
Comment thread source/scriptHandler.py
Comment thread source/baseObject.py Outdated
Comment thread source/baseObject.py
JulienCochuyt and others added 2 commits May 15, 2020 18:20
Co-authored-by: Leonard de Ruijter <leonardder@users.noreply.github.com>
@JulienCochuyt

Copy link
Copy Markdown
Contributor Author

I guess this does not fit well in the existing change log sections, as the bug it fixes mostly affects developers.

Therefore, I think changes for developers fits.

I directly edited the PR description for clarity with a proposed change log entry.
Feel free to amend as you see fit.

JulienCochuyt and others added 2 commits June 11, 2020 15:59

@feerrenrut feerrenrut left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @JulienCochuyt, I'll merge this shortly

@feerrenrut feerrenrut merged commit 0eddf4c into nvaccess:master Jun 11, 2020
@nvaccessAuto nvaccessAuto added this to the 2020.2 milestone Jun 11, 2020
feerrenrut added a commit that referenced this pull request Jun 11, 2020
@JulienCochuyt JulienCochuyt deleted the i5446-superInit branch June 11, 2020 20:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Failing to call super in plug-in constructor breaks script handling

5 participants