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

Define ownership of QSharedMemory* pointer #184

Open
michaelhubatka opened this issue Nov 29, 2023 · 1 comment
Open

Define ownership of QSharedMemory* pointer #184

michaelhubatka opened this issue Nov 29, 2023 · 1 comment

Comments

@michaelhubatka
Copy link

The QSharedMemory object is currently dynamically allocated using the new operator

d->memory = new QSharedMemory( d->blockServerName );

and finally deleted in the abortSafely() function.

I suggest to define an ownership for the pointer. Either by defining a QObject parent in the constructor or by using a std::uniqe_ptr.

This will increase the probability that the destructor of the QSharedMemory object is called for unintended program flows.

@itay-grudev
Copy link
Owner

We are aware of multiple issues with Qt's latest implementation of QSharedMemory and QSystemSemaphore and even the latter is not truly thread safe.

Honestly I don't thing than any more changes will yield more safety and it's rather pointless. When the new implementation based on QLocalSocket is online I think this issue will become obsolete.

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

No branches or pull requests

2 participants