Pamba
Pamba

Reputation: 822

How to retrieve QSharedMemory data

iMy qt application(single instance) store log data in QSharedMemory data segment. While on application exit save the data to file. That working fine.

But in the case of Qt application crash, ie. the data in the shared memory was lost.

I am not used detach() in my application.

can i retrieve the data in the next run?

Upvotes: 2

Views: 340

Answers (1)

Dmitry Sazonov
Dmitry Sazonov

Reputation: 8994

can i retrieve the data in the next run?

It depends on platform that you use. In common, and especially under windows - you can't.

Solution:

You need to create second application (called watchdog) that will have access to your shared memory. And when first application crashes and restores - it will have access to your shared memory, because watchdog will keep it for you.

Upvotes: 1

Related Questions