Fix to Application::isAppAlreadyRunning()

  • Edward Sitarski

    Edward Sitarski - 2007-05-22

    The call to CreateMutex in Application::isAppAlreadyRunning() always fails.

    This CreateMutex call is made with a name created as follows:

        SmartUtil::tstring appPath = getModulePath() + getModuleFileName();

    This name contains backslashes because of the directory paths.

    CreateMutex will fail if there are backslashes in the name (see\).

    This can be corrected by removing the backslashes in isAppAlreadyRunning before the CreateMutex call with:

        // Replace all the backslash characters in the path.
        SmartUtil::tstring::size_type p = 0;
        while( (p = appPath.find(_T('\\'), p)) != SmartUtil::tstring::npos )
            appPath[p] = _T('_');

    After the backslashes are removed, the call to CreateMutex no longer fails.

    • andrew7

      andrew7 - 2007-06-18

      Right you are.   The fix is in CVS.  Thanks.


Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

JavaScript is required for this form.

No, thanks