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

Clean environment when exiting #5941

Merged
merged 1 commit into from
May 8, 2024

Conversation

ikalco
Copy link
Contributor

@ikalco ikalco commented May 8, 2024

Describe your PR, what does it fix/add?

fixes
hyprland doesn't clean up its Wayland sockets after exit #4226

Is there anything you want to mention? (unchecked code, possible bugs, found problems, breaking compatibility, etc.)

Whether we should unlink the wayland sockets is debatable.
Technically wl_display_destroy() should be called to clean up everything wayland.

This function emits the wl_display destroy signal, releases all the sockets added to this display, free's all the globals associated with this display, free's memory of additional shared memory formats and destroy the display object.

I'm not sure why we don't (maybe wlroots manages this?), but when I tried it stalls Hyprland shutdown and just doesn't end up removing the sockets...

Is it ready for merging, or does it need work?

CCompositor::cleanEnvironment works as expected on my system
but also see above

src/Compositor.cpp Outdated Show resolved Hide resolved
Copy link
Member

@vaxerski vaxerski left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

rest lgtm, why draft?

src/Compositor.cpp Outdated Show resolved Hide resolved
@ikalco ikalco marked this pull request as ready for review May 8, 2024 13:24
@ikalco ikalco force-pushed the clean_environment_when_exiting branch from 4531ba9 to 28452f9 Compare May 8, 2024 16:15
@ikalco
Copy link
Contributor Author

ikalco commented May 8, 2024

should be good to go formatting, now should be good

@ikalco ikalco force-pushed the clean_environment_when_exiting branch from 28452f9 to 704f8ed Compare May 8, 2024 16:38
Copy link
Member

@vaxerski vaxerski left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@vaxerski vaxerski merged commit 6a988d9 into hyprwm:main May 8, 2024
8 of 9 checks passed
@ikalco ikalco deleted the clean_environment_when_exiting branch May 8, 2024 21:32
@ikalco ikalco restored the clean_environment_when_exiting branch May 9, 2024 00:09
@ikalco
Copy link
Contributor Author

ikalco commented May 9, 2024

uuuuuh, I accidentally removed this from commit ;-;

diff --git a/src/Compositor.cpp b/src/Compositor.cpp
index 11834043..ac8b11f0 100644
--- a/src/Compositor.cpp
+++ b/src/Compositor.cpp
@@ -451,6 +451,10 @@ void CCompositor::cleanup() {
 
     wl_display_terminate(m_sWLDisplay);
     m_sWLDisplay = nullptr;
+
+    std::string waylandSocket = std::string{getenv("XDG_RUNTIME_DIR")} + "/" + m_szWLDisplaySocket;
+    std::filesystem::remove(waylandSocket);
+    std::filesystem::remove(waylandSocket + ".lock");
 }
 
 void CCompositor::initManagers(eManagersInitStage stage) {

@vaxerski
Copy link
Member

vaxerski commented May 9, 2024

feel free to open a new mr

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.

2 participants