Skip to content

Fix/report query prepare errors - #4230

Open
deepsidhu1313 wants to merge 8 commits into
sqlitebrowser:masterfrom
deepsidhu1313:fix/report-query-prepare-errors
Open

deepsidhu1313 wants to merge 8 commits into
sqlitebrowser:masterfrom
deepsidhu1313:fix/report-query-prepare-errors

Conversation

@deepsidhu1313

Copy link
Copy Markdown
Contributor

SqliteTableModel::setTypedData() accessed m_cache with at(). The cache is
sparse and rows beyond the loaded chunk are valid model rows (rowCount()
includes them), so editing such a row, e.g. by pasting a large clipboard,
raised std::out_of_range ("no matching segment found") and terminated the
application.

Load the row first (triggerCacheLoad + waitUntilIdle, as find() already
does) and skip the edit if it is still not available.

Add a test-table-model target covering both an uncached and a cached row.

Fixes #3892

Co-Authored-By: Claude Sonnet 5.5 noreply@anthropic.com

SqliteTableModel::setTypedData() accessed m_cache with at(). The cache is
sparse and rows beyond the loaded chunk are valid model rows (rowCount()
includes them), so editing such a row, e.g. by pasting a large clipboard,
raised std::out_of_range ("no matching segment found") and terminated the
application.

Load the row first (triggerCacheLoad + waitUntilIdle, as find() already
does) and skip the edit if it is still not available.

Add a test-table-model target covering both an uncached and a cached row.

Fixes sqlitebrowser#3892

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
The test used QTEST_MAIN, which needs a Qt platform plugin and aborted on
the headless CI runners. Select the offscreen platform in main() unless
QT_QPA_PLATFORM is already set.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
RowLoader::process() ignored a statement that failed to prepare, so the
model showed an empty table without setting any error, e.g. after the
table was dropped by another program or while the database was locked.
Emit the error like it is already done for failing steps, so that
SqliteTableModel::lastError() is set.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
create() closes the sqlite3 handle and then calls open(), which closes
the dangling handle a second time. That crashed the test on Windows CI.
Open an empty database file instead.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
test-global-filter needs the CMake prefix paths on PATH on Windows
because the CI jobs build SQLite as a DLL there. test-table-model links
SQLite too and crashed on Windows without them.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
The .ui files connect to slots that don't exist in Qt6 (QDialog::help)
unless uic generates string based connections. The main target already
sets this option for Qt6, but test-table-model compiles CipherDialog.ui
as well and failed to build in the Windows on ARM job.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>

This branch has not been deployed

No deployments
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.

[Bug]: crash when pasting certain data into cell

2 participants