Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Interacting with the application whitelist when a file path to an uninstalled/moved program is in the list crashes LightBulb. #293

Closed
4 of 5 tasks
joas47 opened this issue May 2, 2024 · 8 comments · Fixed by #305
Labels

Comments

@joas47
Copy link

joas47 commented May 2, 2024

Version

v2.4.12

Platform

Windows 10

Steps to reproduce

Whitelist an application - Settings -> Application whitelist -> Add an application
Uninstall the application just whitelisted (i guess moving the folder works too).
Go into the application whitelist again and click anywhere -> LightBulb crashes.

Unable to remove applications from the whitelist.

Details

Able to interact with the whitelist

Can't when an application is removed/moved from it's initial location.

Checklist

  • I have looked through existing issues to make sure that this bug has not been reported before
  • I have provided a descriptive title for this issue
  • I have made sure that this bug is reproducible on the latest version of the application
  • I have provided all the information needed to reproduce this bug as efficiently as possible
  • I have sponsored this project
@joas47 joas47 added the bug label May 2, 2024
@Tyrrrz
Copy link
Owner

Tyrrrz commented May 5, 2024

Good catch. I think the best way to fix it is two-fold:

  1. Add a try/catch for this property so that non-existing applications don't crash LightBulb
  2. Add a filter inside get for this property to remove non-existing applications.

Even with 2., 1. is still needed to avoid potential race conditions.

@ManOnSaturn
Copy link

Hello! New here.

I've tried debugging this, but I keep on bumping into another issue in the whitelist page, which is a Stack Overflow crash when changing one or two options(maybe too quick?). I don't know if what I'm experiencing is connected to what this issue is about, though. It's a continuos loop of calls of OnPropertyChanged after setting the whitelist applications list content.

Using Windows 11, version 2.4.12 and dev build have the same issue.

I also find it difficult to debug. It would be nice to have a guide on how to contribute(setup the project, and maybe instructions on debugging).

@Tyrrrz
Copy link
Owner

Tyrrrz commented May 13, 2024

Hi @ManOnSaturn

I recommend using an IDE like Visual Studio or JetBrains Rider, with the latest .NET SDK installed. They should provide breakpoint and debugging functionality pretty much out of the box.

The issue you're describing may be related to this hack:

_eventRoot.Add(
// This hack is required to avoid having to use an ObservableCollection<T> on the view model
DataContext.WatchProperty(
o => o.WhitelistedApplications,
() =>
WhitelistedApplicationsListBox.SelectedItems = new AvaloniaList<object>(
DataContext.WhitelistedApplications ?? []
)
)
);

It's done so that the application whitelisted can be committed from the UI to the settings in one atomic action (by overwriting the whole list) rather than by adding and removing individual elements.

Also, looking back at my earlier comment:

  1. Add a try/catch for this property so that non-existing applications don't crash LightBulb

This doesn't make much sense, since Path.GetFileNameWithoutExtension(...) shouldn't throw an exception just because the file doesn't exist. Something else must be the source of the exception.

@Tyrrrz
Copy link
Owner

Tyrrrz commented May 15, 2024

I tried reproducing this issue but couldn't do it. Can you clarify which exact action triggers the crash, @joas47? Your "steps to reproduce" worked fine for me.

@HeavyHeart2012
Copy link

Same bug on 2.5

@Tyrrrz
Copy link
Owner

Tyrrrz commented May 22, 2024

Same bug on 2.5

See above

@joas47
Copy link
Author

joas47 commented May 25, 2024

I'm not sure how else to describe it honestly. I go into the application whitelist and click in the area and it crashes the program without an error message or anything. I made a gif of it, hopefully it helps: https://i.imgur.com/d4Fpg24.gif

@Tyrrrz
Copy link
Owner

Tyrrrz commented May 26, 2024

Thanks for the gif, @joas47. I think it might be crashing for a reason other than the fact that the application has been deleted. I have been able to reproduce it, but the fix won't be in this release yet. For now, you can manually remove the application from the whitelist if you edit the Settings.json file in %appdata%/LightBulb/ (or in the app directory, if you use the portable version).

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 a pull request may close this issue.

4 participants