diff options
author | rubidium <rubidium@openttd.org> | 2014-04-28 21:09:19 +0000 |
---|---|---|
committer | rubidium <rubidium@openttd.org> | 2014-04-28 21:09:19 +0000 |
commit | 05f7df39ce98da8f036b35aa023e9218dd03a971 (patch) | |
tree | e2ffb54ea64cced75ed33645998778a1a8466877 /src | |
parent | b476086c394c6bcf893f292ef67565ef2b5496a2 (diff) | |
download | openttd-05f7df39ce98da8f036b35aa023e9218dd03a971.tar.xz |
(svn r26539) -Fix [FS#5994]: [Windows] Crash due to assuming (formerly) _video_driver is being set before the operating system has time to perform the first "paint" callback
Diffstat (limited to 'src')
-rw-r--r-- | src/driver.cpp | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/driver.cpp b/src/driver.cpp index 70f695122..825c489b9 100644 --- a/src/driver.cpp +++ b/src/driver.cpp @@ -116,15 +116,18 @@ bool DriverFactoryBase::SelectDriverImpl(const char *name, Driver::Type type) if (d->type != type) continue; if (d->priority != priority) continue; + Driver *oldd = *GetActiveDriver(type); Driver *newd = d->CreateInstance(); + *GetActiveDriver(type) = newd; + const char *err = newd->Start(NULL); if (err == NULL) { DEBUG(driver, 1, "Successfully probed %s driver '%s'", GetDriverTypeName(type), d->name); - delete *GetActiveDriver(type); - *GetActiveDriver(type) = newd; + delete oldd; return true; } + *GetActiveDriver(type) = oldd; DEBUG(driver, 1, "Probing %s driver '%s' failed with error: %s", GetDriverTypeName(type), d->name, err); delete newd; } |