Fix to Application::isAppAlreadyRunning()

  • 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

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