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

Crash when introducing a scroll area mid frame #314

Open
emoon opened this issue Mar 6, 2025 · 0 comments
Open

Crash when introducing a scroll area mid frame #314

emoon opened this issue Mar 6, 2025 · 0 comments

Comments

@emoon
Copy link
Contributor

emoon commented Mar 6, 2025

Here

Clay_ScrollContainerData Clay_GetScrollContainerData(Clay_ElementId id) {
  ...
  .config = *Clay__FindElementConfigWithType(scrollContainerData->layoutElement, CLAY__ELEMENT_CONFIG_TYPE_SCROLL).scrollElementConfig,

This call above can be NULL which causes a crash due to the de-ref. I have change so I do this locally, but I'm unsure if it's correct or not (but it seems to work)

      Clay_ScrollElementConfig* scrollConfig = Clay__FindElementConfigWithType(scrollContainerData->layoutElement, CLAY__ELEMENT_CONFIG_TYPE_SCROLL).scrollElementConfig;
            if (!scrollConfig) {
                return CLAY__INIT(Clay_ScrollContainerData) CLAY__DEFAULT_STRUCT;
            }

            return CLAY__INIT(Clay_ScrollContainerData) {
                .scrollPosition = &scrollContainerData->scrollPosition,
                .scrollContainerDimensions = { scrollContainerData->boundingBox.width, scrollContainerData->boundingBox.height },
                .contentDimensions = scrollContainerData->contentSize,
                .config = *scrollConfig,
                .found = true
            };
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

No branches or pull requests

1 participant