Skip to content

Conversation

@parro-it
Copy link
Owner

API for tables are completed. I wrote this PR so we can review the code and keep track of further refinements.

  • Document table classes, reusing @andlabs comments as much as possible.
  • Document metadata models
  • Implement memory management:
    (1) we must increase reference count of model instances when they are attached to a table, and decrement it when they get detached, or the table get destroyed.
    (2) we must increase reference count of UiImage instances every time they are returned by a js cell getter, but when can we decrement it? @andlabs said we can safely do it after next UI events are completely executed, but I guess only if the particular UI event that cause libui to redraw the table is received. So how can we detect this? Have we to check for different events types on each platform?

@parro-it
Copy link
Owner Author

Also, libui take ownership of every uiTableValue that gots feed to a uiTable:

// @role uiTableValue destructor
// uiFreeTableValue() frees a uiTableValue. You generally do not
// need to call this yourself, as uiTable and uiTableModel do this
// for you. In fact, it is an error to call this function on a uiTableValue
// that has been given to a uiTable or uiTableModel. You can call this,
// however, if you created a uiTableValue that you aren't going to
// use later, or if you called a uiTableModelHandler method directly
// and thus never transferred ownership of the uiTableValue.
_UI_EXTERN void uiFreeTableValue(uiTableValue *v);

So, we should track if a uiTableValue is fed to a uiTable, and if it is, we should avoid calling uiFreeTableValue when it get garbage collected

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.

4 participants