Skip to content

fix: add null check for g_IPCSocket in onRepeatTimer#368

Merged
vaxerski merged 1 commit into
hyprwm:mainfrom
kioz-wang:fix/null-check-ipc-socket-on-wallpaper-changed
May 25, 2026
Merged

fix: add null check for g_IPCSocket in onRepeatTimer#368
vaxerski merged 1 commit into
hyprwm:mainfrom
kioz-wang:fix/null-check-ipc-socket-on-wallpaper-changed

Conversation

@kioz-wang
Copy link
Copy Markdown
Contributor

Summary

Fixes a SIGSEGV crash when IPC is disabled (ipc = 0 in config) and wallpaper rotation is active.

Root Cause

CWallpaperTarget::onRepeatTimer() calls IPC::g_IPCSocket->onWallpaperChanged() without checking if g_IPCSocket is valid. When IPC is disabled or not initialized, g_IPCSocket is nullptr, causing a null pointer dereference.

Crash Analysis (coredump)

Signal: SIGSEGV (11)
  #0  __gnu_cxx::__normal_iterator constructor (this->m_statusObjects, this=0x60)
  #1  std::vector::begin (this=0x60)
  #2  IPC::CSocket::onWallpaperChanged (this=0x0, mon="eDP-1", path="...")
  #3  CWallpaperTarget::onRepeatTimer

GDB confirmed this=0x0 in onWallpaperChangedg_IPCSocket.get() returned nullptr.

Since CSocket::m_statusObjects is at offset 0x60, accessing this->m_statusObjects when this=0x0 resolves to address 0x60, which is unmapped → SIGSEGV.

Fix

Add a null guard matching the pattern already used in registerOutput() and elsewhere:

if (IPC::g_IPCSocket)
    IPC::g_IPCSocket->onWallpaperChanged(m_monitorName, m_lastPath);

Note

IPC and wallpaper display are independent — wallpapers work fine without IPC. The crash only affects users who have wallpaper rotation configured while IPC is disabled.

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)
  hyprwm#1  IPC::CSocket::onWallpaperChanged (this=0x0)
  hyprwm#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.
@vaxerski
Copy link
Copy Markdown
Member

@fufexan what

@fufexan
Copy link
Copy Markdown
Member

fufexan commented May 25, 2026

I have no clue. We don't even use an access token so I have no idea why it would fail.

@vaxerski
Copy link
Copy Markdown
Member

fix pls?

@fufexan
Copy link
Copy Markdown
Member

fufexan commented May 25, 2026

enjoy

@vaxerski
Copy link
Copy Markdown
Member

tnx

@vaxerski vaxerski merged commit c011bd2 into hyprwm:main May 25, 2026
1 of 3 checks passed
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.

3 participants