internal: fix missing null check for g_IPCSocket in onRepeatTimer (#368)

CWallpaperTarget::onRepeatTimer() calls IPC::g_IPCSocket->onWallpaperChanged()
without checking if g_IPCSocket is valid. When IPC is disabled (ipc=0) or
not initialized, g_IPCSocket is nullptr, causing a SIGSEGV.

Stack trace from coredump:
  #0  __normal_iterator constructor (this->m_statusObjects at 0x60)
  #1  IPC::CSocket::onWallpaperChanged (this=0x0)
  #2  CWallpaperTarget::onRepeatTimer

GDB confirms this=0x0 in onWallpaperChanged, meaning g_IPCSocket.get()
returned nullptr when dereferenced.

Fix: add a null guard matching the pattern already used in registerOutput()
and elsewhere in the codebase.
This commit is contained in:
Kioz
2026-05-25 23:27:25 +08:00
committed by GitHub
parent 20fc0fa6c2
commit c011bd2088

View File

@ -140,7 +140,8 @@ void CWallpaperTarget::onRepeatTimer() {
m_timer = m_timer =
m_backend->addTimer(std::chrono::milliseconds(std::chrono::seconds(m_imagesData->timeout)), [this](ASP<Hyprtoolkit::CTimer> self, void*) { onRepeatTimer(); }, nullptr); m_backend->addTimer(std::chrono::milliseconds(std::chrono::seconds(m_imagesData->timeout)), [this](ASP<Hyprtoolkit::CTimer> self, void*) { onRepeatTimer(); }, nullptr);
IPC::g_IPCSocket->onWallpaperChanged(m_monitorName, m_lastPath); if (IPC::g_IPCSocket)
IPC::g_IPCSocket->onWallpaperChanged(m_monitorName, m_lastPath);
} }
void CUI::registerOutput(const SP<Hyprtoolkit::IOutput>& mon) { void CUI::registerOutput(const SP<Hyprtoolkit::IOutput>& mon) {