Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Avoid creating objects in global scope #328

Closed
adangel opened this issue Apr 8, 2022 · 0 comments · Fixed by #329
Closed

Avoid creating objects in global scope #328

adangel opened this issue Apr 8, 2022 · 0 comments · Fixed by #329
Milestone

Comments

@adangel
Copy link
Collaborator

adangel commented Apr 8, 2022

From the review https://extensions.gnome.org/review/31260:

Just noticed about new Gio.FileIcon() in convenience.js and settings in (settings.js).
Please check other files too, I may missed other ones.
You cannot create objects in global scope which is the same as init:
https://gjs.guide/extensions/review-guidelines/review-guidelines.html#only-use-init-for-initialization

We are against those because:

For example, when you fill settings which is in global scope, it won't be null after disable.
That's not good, because the object remains there without any reason.
Also the callbacks for signals can get triggered while the extension is disabled.
This is not only an error but also a security risk in some cases,
since extension is disabled on lock screen.

So objects should be created in enable() process and null out in disable() process.

@adangel adangel added this to the 1.6.1 milestone Apr 8, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant