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

fix: store IPC file in application directory #5226

Merged
merged 6 commits into from
Mar 3, 2024

Conversation

Nerixyz
Copy link
Contributor

@Nerixyz Nerixyz commented Mar 2, 2024

While trying to create a message_queue with windows_shared_memory, I noticed that it's not really possible without writing one completely from scratch (i.e. not using any /detail headers) while only requiring a minimum boost version (we'd need to wait for Boost.Interprocess to implement something like it).
But I discovered that we can set BOOST_INTERPROCESS_SHARED_DIR_FUNC and provide two functions that supply the directory of the IPC files. That's what I have done here.

The functions provide the directory of Paths::ipcDirectory, which is <appDataDirectory>/IPC on Windows and /tmp everywhere else.
Since the functions don't provide any context parameter, we need to use global state. The state is set once with ipc::initPaths.

In my opinion, this does not resolve the issue #4084, since a memory mapped file is still created (...which can get large(?)). It partly fixes it, as the files are no longer outside the directory, hence the title "fix:".

@pajlada pajlada enabled auto-merge (squash) March 3, 2024 11:51
@pajlada pajlada linked an issue Mar 3, 2024 that may be closed by this pull request
4 tasks
@pajlada pajlada merged commit 449c539 into Chatterino:master Mar 3, 2024
17 checks passed
@Nerixyz Nerixyz deleted the fix/super-global-ipc branch March 3, 2024 12:16
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.

Portable creates "chatterino_gui" on "C:\ProgramData\boost_interprocess\"
2 participants