mhorowitz
Posts: 12
Joined: Sat Jul 26, 2008 7:11 am

After updater run, application runs twice, on vista

We have integrated the updater into our application as in http://www.advancedinstaller.com/user-g ... dater.html. We are seeing two problems when there is an update pending:

1. When we run this code, sometimes (often on vista, sometimes on XP), the code runs through to the end while the updater is still running. This results in some undesirable UI behavior in our code.

2. Once the updater is complete, the application runs twice. I speculate that this is because the installer runs a copy of the app (we have enabled Launch Application in the ExitDialog), and the updater runs a copy, too.

Is there a fix for these problems? Thank you.
mhorowitz
Posts: 12
Joined: Sat Jul 26, 2008 7:11 am

Re: After updater run, application runs twice, on vista

A little more background:

I did some logging, and I can see that updater.exe is exiting with status 0 (which seems right), and then the mutex is signalled almost immediately after (which seems wrong). My code for the mutex check looks like this:

Code: Select all

    HANDLE mutex = 0;

    while (!m_cancelled) {
      mutex = ::OpenMutex(SYNCHRONIZE, FALSE, &mutexPath[0]);

      if (mutex != 0)
        break;

      Sleep(100);
    }

    if (m_cancelled) {
      return;
    }

    while (!m_cancelled && ret == WAIT_TIMEOUT)
      ret = ::WaitForSingleObject(mutex, WAITFOR_TIMEOUT_MS);

    if (ret == WAIT_OBJECT_0)
      cerr << "mutex signalled";
I added the OpenMutex retry loop because I observed previously that it was failing because the mutex had not been created yet. However, now that I wait until it is, I see "mutex signalled" in my logs soon after.

How can I make sure that my update logic does not finish until after the entire update completes? Thank you.
mhorowitz
Posts: 12
Joined: Sat Jul 26, 2008 7:11 am

Re: After updater run, application runs twice, on vista

Bump. Is there a way to avoid the double-run at the end of an update?
Cosmin
Posts: 5797
Joined: Tue Jul 10, 2007 6:39 pm
Contact: Website

Re: After updater run, application runs twice, on vista

Hi,
Once the updater is complete, the application runs twice.
Are you using the auto close application feature? If so, you can try disabling the auto-restart.
How can I make sure that my update logic does not finish until after the entire update completes?
The Updater should return only after the updates are installed. Note that there are separate code samples for waiting after the update check and waiting for the update install. Both should be included in your application. If you need a working sample please contact us at support at advancedinstaller dot com.

Regards,
Cosmin
Cosmin Pirvu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Return to “Common Problems”