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

uiTableModelInsertRow() causes invalid rows to be accessed (on windows) #416

Open
bcampbell opened this issue Aug 24, 2018 · 0 comments · Fixed by libui-ng/libui-ng#20 · May be fixed by #484 or #515
Open

uiTableModelInsertRow() causes invalid rows to be accessed (on windows) #416

bcampbell opened this issue Aug 24, 2018 · 0 comments · Fixed by libui-ng/libui-ng#20 · May be fixed by #484 or #515
Milestone

Comments

@bcampbell
Copy link
Contributor

If uiTableModelInsertRow() is called on an active uiTable, the table will then try to fetch one row more than what the model provides.
If the table already has a lot of content, the invalid fetch won't occur until you scroll right down to bring the last row into view.

Seems to be windows-specific.

example here:
https://github.com/bcampbell/libui/blob/destruc-table/examples/destruc-table/main.c

@andlabs andlabs added this to the Alpha 5 milestone Dec 31, 2018
pftbest pushed a commit to pftbest/libui that referenced this issue Feb 5, 2020
…ad of 1.

When LVM_INSERTITEM is called after we updated LVM_SETITEMCOUNT,
the actual count will be increased by one causing one extra item
to appear in the table and loading data from the model.
This extra item is invisible at first because it doesn't get painted but
you can click on it to confirm that it is actually there.

To fix this problem we need to call INSERTITEM first and
then update the ITEMCOUNT.

Fixes andlabs#416
Fixes andlabs/ui#369

cc @bcampbell
r? @andlabs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment