fixes/patches for win32/vs2013 startup and shutdown

This commit is contained in:
wangyix 2014-09-10 12:24:59 -07:00
parent c815ee53c9
commit 7a2897fb6b
3 changed files with 18 additions and 0 deletions

View file

@ -3357,7 +3357,10 @@ void Application::updateWindowTitle(){
title += " - ₵" + creditBalanceString;
}
#ifndef WIN32
// crashes with vs2013/win32
qDebug("Application title set to: %s", title.toStdString().c_str());
#endif !WIN32
_window->setWindowTitle(title);
}

View file

@ -164,14 +164,24 @@ void Audio::audioMixerKilled() {
resetStats();
}
QAudioDeviceInfo getNamedAudioDeviceForMode(QAudio::Mode mode, const QString& deviceName) {
QAudioDeviceInfo result;
#ifdef WIN32
// NOTE
// this is a workaround for a windows only QtBug https://bugreports.qt-project.org/browse/QTBUG-16117
// static QAudioDeviceInfo objects get deallocated when QList<QAudioDevieInfo> objects go out of scope
result = (mode == QAudio::AudioInput) ?
QAudioDeviceInfo::defaultInputDevice() :
QAudioDeviceInfo::defaultOutputDevice();
#else
foreach(QAudioDeviceInfo audioDevice, QAudioDeviceInfo::availableDevices(mode)) {
qDebug() << audioDevice.deviceName() << " " << deviceName;
if (audioDevice.deviceName().trimmed() == deviceName.trimmed()) {
result = audioDevice;
}
}
#endif
return result;
}
@ -277,6 +287,7 @@ QAudioDeviceInfo defaultAudioDeviceForMode(QAudio::Mode mode) {
pMMDeviceEnumerator = NULL;
CoUninitialize();
}
qDebug() << "DEBUG [" << deviceName << "] [" << getNamedAudioDeviceForMode(mode, deviceName).deviceName() << "]";
return getNamedAudioDeviceForMode(mode, deviceName);

View file

@ -215,7 +215,11 @@ void Resource::allReferencesCleared() {
_cache->addUnusedResource(self);
} else {
#ifndef WIN32
// Note to Andrzej this causes a consistent crash on windows/vs2013
// patching here as a very temporary workaround. --craig
delete this;
#endif // !WIN32
}
}