Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Keeping a single instance of an applicaton

Keeping a single instance of an applicaton

Scheduled Pinned Locked Moved Unsolved General and Desktop
ipclock
5 Posts 3 Posters 1.7k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    ArsenArsen
    wrote on last edited by
    #1

    Hey guys, I am wondering what's the proper and cross platform (if possible) way to keep a single instance of an application, with some additional IPC (like making the already running app visible if it's being ran again). Does anyone have any advice? Thanks in advance

    1 Reply Last reply
    0
    • mrjjM Offline
      mrjjM Offline
      mrjj
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi
      Normally QSharedMemory or QLocalServer is used.
      However, its a pretty common requirement so
      maybe this could work for you ?
      https://github.com/itay-grudev/SingleApplication

      info:
      https://stackoverflow.com/questions/5006547/qt-best-practice-for-a-single-instance-app-protection

      A 1 Reply Last reply
      2
      • mrjjM mrjj

        Hi
        Normally QSharedMemory or QLocalServer is used.
        However, its a pretty common requirement so
        maybe this could work for you ?
        https://github.com/itay-grudev/SingleApplication

        info:
        https://stackoverflow.com/questions/5006547/qt-best-practice-for-a-single-instance-app-protection

        A Offline
        A Offline
        ArsenArsen
        wrote on last edited by
        #3

        @mrjj Hey there, thanks for responding! My concern with any of these methods is an edge case (such as an application crash, or even system crash), leading to improper cleanup and because of that failure to restart the application later, especially on Windows. Looking through the implementation of SingleApplication it does not seem like it handles such situations on Windows. On Unix it makes handlers for many signals to clean up the shared memory, but there seems to be no analogue for that on Windows. Does Windows handle shared memory differently?

        1 Reply Last reply
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #4

          Hi,

          Did you also check the QSingleApplication from the Qt solutions ?

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          A 1 Reply Last reply
          2
          • SGaistS SGaist

            Hi,

            Did you also check the QSingleApplication from the Qt solutions ?

            A Offline
            A Offline
            ArsenArsen
            wrote on last edited by
            #5

            @SGaist I have not, as I thought the project is unmaintaned and unsupported. I'll check out that implementation too since you're bringing it up though. Thanks

            1 Reply Last reply
            0

            • Login

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • Users
            • Groups
            • Search
            • Get Qt Extensions
            • Unsolved