-
-
Notifications
You must be signed in to change notification settings - Fork 976
Make CssReloadHelper watch CSS new style on appearance change #4804
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
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -10,7 +10,7 @@ | |
|
|
||
| class CssReloadHelperTest : public waybar::CssReloadHelper { | ||
| public: | ||
| CssReloadHelperTest() : CssReloadHelper("/tmp/waybar_test.css", [this]() { callback(); }) {} | ||
| CssReloadHelperTest() : CssReloadHelper("/tmp/waybar_test.css", [this](const std::string&) { callback(); }) {} | ||
|
||
|
|
||
| void callback() { m_callbackCounter++; } | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's a potential race condition in
changeCssFile. If a file change event from the old monitors fires afterm_fileMonitors.clear()but during or afterm_cssFile = newCssFile, thehandleFileChangecallback will be invoked with the new CSS file path for a change in the old file. To fix this, the new CSS file path should be assigned after setting up the new monitors, or the old signal connections should be explicitly disconnected before clearing the monitors.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If I am not mistaken, clearing
m_fileMonitorsdrops all of the old monitors since they no longer have any references.