Repository navigation
Fix hang on broken project files, empty settings files, row count wrap-around and plot button style - #4248
Open
deepsidhu1313 wants to merge 3 commits into
Open
Fix hang on broken project files, empty settings files, row count wrap-around and plot button style#4248deepsidhu1313 wants to merge 3 commits into
deepsidhu1313 wants to merge 3 commits into
Conversation
…X rows RowLoader::countRows() read the result of the COUNT query with sqlite3_column_int(), which truncates to 32 bits. For a result above INT_MAX this either produced a negative number, which was silently dropped so that the row count never completed, or a small or otherwise wrong number that was then taken as the real number of rows. Read it as a 64-bit value and clamp it to INT_MAX, the largest number that the rowCountComplete signal and the table model can represent. The model's rows limit then applies as usual, which keeps such tables away from the QTableView pixel overflow that the limit works around. Add a RowLoader test which feeds counts around and beyond INT_MAX through an explicit count query. Related: sqlitebrowser#2592
Project files: The loops which read the elements of a project file used the condition "readNext() != EndElement && name != <element>". Once the XML reader hits an error, e.g. because the file is cut off or contains invalid XML, it only returns Invalid tokens from then on, so these loops never ended. The application then spun at 100% CPU while opening such a project file, before even showing its window. Stop the loops when the reader has reached the end of the document or failed, which cannot happen for well-formed input before the element was closed. The elements which have been read up to there are still restored and the user is now told that the project file could not be read completely. Extend the global filter test with broken documents: it runs GlobalFilter::load() on a worker thread with a time limit, so that a loop which does not end fails the test instead of hanging it. Settings files: The -S/--settings option and the import of settings only accepted a file if its first line is "[%General]". A file which already exists but is still empty, e.g. one which has been created in advance for a portable installation, has no first line at all and was rejected as "not a normal settings file", so the option was ignored and the settings ended up in the registry or the user's configuration instead. Treat an empty file like one which doesn't exist yet. Files with other content are still rejected. Add a test for the settings file handling. Related: sqlitebrowser#2791
The button is meant to turn red when not all data has been fetched yet, to hint that the plot is incomplete. Its style sheet only set the colours but no border, so the button was still drawn by the style of the application, which then has to take the background colour from the palette. Some platform themes and styles don't do that (QT_QPA_PLATFORMTHEME set to qt5ct or gtk2 for example), and the button stayed in the normal colours. Also set a border in the style sheet. This makes Qt draw the complete button from the style sheet, whatever the style of the application is. Add a test which shows the plot of a partially fetched table and checks that the button is red with the Fusion and Windows styles as well as with a style that ignores the palette (a stand-in for the platform themes), and that it is not red when all data has been fetched. Related: sqlitebrowser#2001
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Three independent commits.
Refs #2592, #2791, #2001