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

only add circuitpython_splash to display if it's not in another group #7829

Merged
merged 2 commits into from
Apr 5, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion shared-module/displayio/Display.c
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,9 @@ void common_hal_displayio_display_construct(displayio_display_obj_t *self,

// Set the group after initialization otherwise we may send pixels while we delay in
// initialization.
common_hal_displayio_display_set_root_group(self, &circuitpython_splash);
if (!circuitpython_splash.in_group) {
Copy link
Member

Choose a reason for hiding this comment

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

This code looks fine, but I noticed a few lines later it checks if root_group is NULL and if so assigns it to circuitpython_splash with no checks and not using the function. Not sure how that may affect anything. But your check on its own looks good.

Copy link

Choose a reason for hiding this comment

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

Are you talking about when calling display.show(None) ? It uses common_hal_displayio_display_show which does a few checks, including if the group is already in a group, and returns False when those checks fail. That return is checked and an exception is raised in the shared-bindings part:

bool ok = common_hal_displayio_display_show(self, group);
if (!ok) {
mp_raise_ValueError(translate("Group already used"));
}

Maybe it could use common_hal_displayio_display_set_root_group instead. (show() is deprecated anyway).

common_hal_displayio_display_set_root_group(self, &circuitpython_splash);
}
common_hal_displayio_display_set_auto_refresh(self, auto_refresh);
}

Expand Down