-
-
Notifications
You must be signed in to change notification settings - Fork 218
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
Using QSharedMemory for SingleApplication might stop working as of Qt 6.6 #170
Comments
Technically I found a workaround for releasing SingleApplication/singleapplication.cpp Lines 67 to 75 in 6dde626
Lockfiles on the other hand suffer from the same problem when an instance has crashed. Originally I tried implementing it with a lockfile, but found that to be too unreliable. But maybe we can give it another look. Another option would be to handle the SingleAplication functionality completely through |
One issue when using local sockets that I know of is if an app is busy and doesn't reply to the message in time. It can happen if the main event loop is blocked doing a task. To account for this we'll have to always start a separate thread for the SingleApplication QLocalServer. |
I can confirm, it looks like SingleApplication doesn't work anymore with Qt 6.6... |
Works great on Linux, thanks, I'll try on other platforms tomorrow! |
Thanks @jonaski |
Thiago just posted on the Qt dev mailing-list, see https://lists.qt-project.org/pipermail/development/2023-November/044680.html and https://codereview.qt-project.org/c/qt/qtbase/+/518039 |
According to Thiago Macieira we are using QSharedMemory for something it wasn't designed for. Basically we are using it in the same way as Qt Creator's QtSingleApplication, which he claims is wrong. Might be worth considering switching to using a lockfile instead.
The QString based constructor we use will be deprecated as of 6.10, with the recent changes to QSharedMemory, it currently does not work at all in our use-case.
When using the new QNativeIpcKey constructor, it works, but it's impossible to release the previous QSharedMemory instance when the program crashes or is forcefully quit. See: https://code.qt.io/cgit/qt/qtbase.git/tree/src/corelib/ipc/qsharedmemory.h
The bug report I filed is here: https://bugreports.qt.io/browse/QTBUG-111855
I switched to https://github.com/KDAB/KDSingleApplication which uses a lockfile, at least until we can solve this, because I use Qt from dev for debugging, and I switched to the new QNativeIpcKey constructor because the old didn't work at all, and will be deprecated anyway, but each time I had to stop and start debugging I had to rename the appdata name or remove the SingleApplication code which was too much hassle.
The text was updated successfully, but these errors were encountered: