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

free more memory on destruction #6348

Merged
merged 4 commits into from
Jun 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion src/Compositor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ void CCompositor::initServer() {
m_sWLEventLoop = wl_display_get_event_loop(m_sWLDisplay);

// register crit signal handler
wl_event_loop_add_signal(m_sWLEventLoop, SIGTERM, handleCritSignal, nullptr);
m_critSigSource = wl_event_loop_add_signal(m_sWLEventLoop, SIGTERM, handleCritSignal, nullptr);

if (!envEnabled("HYPRLAND_NO_CRASHREPORTER")) {
signal(SIGSEGV, handleUnrecoverableSignal);
Expand Down Expand Up @@ -373,6 +373,9 @@ void CCompositor::cleanup() {
if (m_sWLRBackend)
wlr_backend_destroy(m_sWLRBackend);

if (m_critSigSource)
wl_event_source_remove(m_critSigSource);

wl_display_terminate(m_sWLDisplay);
m_sWLDisplay = nullptr;

Expand Down
17 changes: 9 additions & 8 deletions src/Compositor.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -178,14 +178,15 @@ class CCompositor {
std::string explicitConfigPath;

private:
void initAllSignals();
void removeAllSignals();
void cleanEnvironment();
void setRandomSplash();
void initManagers(eManagersInitStage stage);
void prepareFallbackOutput();

uint64_t m_iHyprlandPID = 0;
void initAllSignals();
void removeAllSignals();
void cleanEnvironment();
void setRandomSplash();
void initManagers(eManagersInitStage stage);
void prepareFallbackOutput();

uint64_t m_iHyprlandPID = 0;
wl_event_source* m_critSigSource = nullptr;
};

inline std::unique_ptr<CCompositor> g_pCompositor;
2 changes: 1 addition & 1 deletion src/desktop/Popup.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ void CPopup::onCommit(bool ignoreSiblings) {
onDestroy();
return;
}

if (m_pResource->surface->initialCommit) {
m_pResource->surface->scheduleConfigure();
return;
Expand Down
3 changes: 3 additions & 0 deletions src/managers/CursorManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,9 @@ CCursorManager::CCursorManager() {
CCursorManager::~CCursorManager() {
if (m_pWLRXCursorMgr)
wlr_xcursor_manager_destroy(m_pWLRXCursorMgr);

if (m_pAnimationTimer)
wl_event_source_remove(m_pAnimationTimer);
}

void CCursorManager::dropBufferRef(CCursorManager::CCursorBuffer* ref) {
Expand Down
5 changes: 5 additions & 0 deletions src/managers/PointerManager.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,11 @@ class CPointerManager {

struct SMonitorPointerState {
SMonitorPointerState(SP<CMonitor> m) : monitor(m) {}
~SMonitorPointerState() {
if (cursorFrontBuffer)
wlr_buffer_unlock(cursorFrontBuffer);
}

WP<CMonitor> monitor;

int softwareLocks = 0;
Expand Down
Loading