Skip to content

Fix a few UI crashes and error handling gaps - #473

Open
indep-arg wants to merge 13 commits into
lostindark:masterfrom
indep-arg:master
Open

indep-arg wants to merge 13 commits into
lostindark:masterfrom
indep-arg:master

Conversation

@indep-arg

Copy link
Copy Markdown
Contributor

A follow-up to #470 with some smaller issues I found in the same pass. Each fix is a separate commit.

1. Crash on Shift+click of a column header after switching language (MyObjectListView.cs, DSEForm.cs)

Switching language calls InitializeComponent() again, which creates a new list view. RestoreState only restores the primary sort column, so SecondarySortColumn is null on the new list and HandleColumnClick throws a NullReferenceException on Shift+click. The secondary sort column is now kept across the switch, and the click handler checks for null.

2. App reopens minimized if it was closed while minimized (DSEForm.cs)

If you close it from the taskbar while it's minimized, FormClosing saves WindowState = Minimized and the location (-32000, -32000), so the next start opens minimized. It now saves Normal and the restore position instead.

3. "Copy folder path" crashes when the folder is unknown (DSEForm.cs)

With the PnpUtil backend, a package that can't be matched to a driver store folder has an empty DriverFolderLocation. Clipboard.SetText("") throws, and "Open folder" runs explorer /select, [Unknown], which opens Documents. Both menu items are now disabled when there's no folder.

4. Add driver: the INF search can throw an unhandled exception (DSEForm.cs)

FindInfFile(...).ToList() runs before the try block, so an unreadable subfolder or a path that's too long in a deep driver bundle crashes the async handler. It now shows an error instead.

5. Add driver: only the first INF in the selected folder is added (DSEForm.cs)

If the selected folder has INFs at the top level, only the first one is added. If it has none, the recursive search added in #437 adds all of them. So a folder with several INFs, which is common for chipset and audio packages, is only partly added unless you pick its parent. It now adds all the top-level INFs. This changes behavior, so let me know if taking only the first one was intentional and I'll drop this commit.

6. CSV export crashes on access denied (DSEForm.cs)

ExportDriverList catches IOException and SecurityException, but saving over a read-only file throws UnauthorizedAccessException. I added it to the filter.

7. DISM: one unreadable driver folder breaks the whole list (DismUtil.cs)

GetFolderSize was called without a try, so one missing or unreadable folder made EnumeratePackages fail and the list came up empty. It's now handled per package, like NativeDriverStore already does.

@indep-arg

Copy link
Copy Markdown
Contributor Author

Before
before

After
after

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.

1 participant