Skip to content

Conversation

@mgrojo
Copy link
Member

@mgrojo mgrojo commented Jan 8, 2018

The crash is avoided if the table model is not editable, since insertRows
checks that. A table model for a DB view should be not editable, so this
fix avoids the crash and possibly other possible misbehaviours.

I open this pull request:

The crash is avoided if the table model is not editable, since insertRows
checks that. A table model for a DB view should be not editable, so this
fix avoids the crash and possibly other possible misbehaviours.
@justinclift
Copy link
Member

Good catch. Definitely a @MKleusberg thing for reviewing though, even though it's super simple. 😄

@MKleusberg
Copy link
Member

Thanks, @mgrojo, good catch! 😃 This looks like the correct way to fix this with no side-effects.

For #141 we will need a different approach than just reverting back. Actually view editing is already partly implemented and relies on the "Pseudo PK" setting (named like that for lack of a better term) in the SqliteTableModel class. So if the isEditable() function is called for a view, we need to check if there is a pseudo-PK before returning true.

But I will just merge this PR now and add the view bits in a second 😄

@MKleusberg MKleusberg merged commit 512b694 into master Jan 13, 2018
@MKleusberg MKleusberg deleted the crash_insert_row_in_view branch January 13, 2018 15:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants