Win32+Qt332
我一个子线程中调用了QSound用来播放声音,
发现在个别情况下会发现有问题
具体在如下代码时线程死掉了
void MProcess::resetSound
{
if( sound != NULL)
{
sound->stop();
delete sound;
sound = NULL;
}
}
其中sound是一个QSound对象,
在其他地方初始化
void MProcess::PlaySound()
{
resetSound();
sound = new QSound(fileName);
sound->setLoops(3000);
sound->play();
}
其中PlaySound会被我期中的一个子线程调用,但通过打印语句跟踪,
发现该子线程在调用resetSound()中的sound->stop()后函数没有退出。
导致我的线程堵塞。
不知道有谁知道?