Details
-
Bug
-
Resolution: Done
-
P2: Important
-
5.4.1
-
None
-
windows 8.1 64bit compiled using qt5.4.1 32bit msvc2013 opengl
-
edc415be476c7ef59f00914b2a6dfc6896d7a34d
Description
I have a strange crash, here is the call stack during crash:
MSVCR120D.dll!memcpy(unsigned char * dst=0x000044e8, unsigned char * src=0x00000000, unsigned long count=3518728) Line 188 Unknown Qt5Cored.dll!QIODevice::read(char * data=0x00000000, __int64 maxSize=17640) Line 862 C++ > qtaudio_windowsd.dll!QWindowsAudioOutput::deviceReady() Line 608 C++ qtaudio_windowsd.dll!QWindowsAudioOutput::qt_static_metacall(QObject * _o=0x08aeed20, QMetaObject::Call _c=InvokeMetaMethod, int _id=1, void * * _a=0x09317848) Line 72 C++ Qt5Cored.dll!QMetaCallEvent::placeMetaCall(QObject * object=0x08aeed20) Line 485 C++ Qt5Cored.dll!QObject::event(QEvent * e=0x0964c7d0) Line 1246 C++ Qt5Widgetsd.dll!QApplicationPrivate::notify_helper(QObject * receiver=0x08aeed20, QEvent * e=0x0964c7d0) Line 3720 C++ Qt5Widgetsd.dll!QApplication::notify(QObject * receiver=0x08aeed20, QEvent * e=0x0964c7d0) Line 3164 C++ Qt5Cored.dll!QCoreApplication::notifyInternal(QObject * receiver=0x08aeed20, QEvent * event=0x0964c7d0) Line 935 C++ Qt5Cored.dll!QCoreApplication::sendEvent(QObject * receiver=0x08aeed20, QEvent * event=0x0964c7d0) Line 228 C++ Qt5Cored.dll!QCoreApplicationPrivate::sendPostedEvents(QObject * receiver=0x00000000, int event_type=0, QThreadData * data=0x002de0e8) Line 1552 C++ Qt5Cored.dll!QCoreApplication::sendPostedEvents(QObject * receiver=0x00000000, int event_type=0) Line 1410 C++ qwindowsd.dll!QWindowsGuiEventDispatcher::sendPostedEvents() Line 81 C++ Qt5Cored.dll!qt_internal_proc(HWND__ * hwnd=0x00050a56, unsigned int message=1025, unsigned int wp=0, long lp=0) Line 414 C++ user32.dll!_InternalCallWinProc@20() Unknown user32.dll!_UserCallWinProcCheckWow@32() Unknown user32.dll!_DispatchMessageWorker@8() Unknown user32.dll!_DispatchMessageW@4() Unknown Qt5Cored.dll!QEventDispatcherWin32::processEvents(QFlags<enum QEventLoop::ProcessEventsFlag> flags={...}) Line 807 C++ qwindowsd.dll!QWindowsGuiEventDispatcher::processEvents(QFlags<enum QEventLoop::ProcessEventsFlag> flags={...}) Line 73 C++ Qt5Cored.dll!QEventLoop::processEvents(QFlags<enum QEventLoop::ProcessEventsFlag> flags={...}) Line 129 C++ Qt5Cored.dll!QEventLoop::exec(QFlags<enum QEventLoop::ProcessEventsFlag> flags={...}) Line 204 C++ Qt5Cored.dll!QCoreApplication::exec() Line 1188 C++ Qt5Guid.dll!QGuiApplication::exec() Line 1508 C++ Qt5Widgetsd.dll!QApplication::exec() Line 2957 C++ qgroundcontrol.exe!main(int argc=1, char * * argv=0x002de008) Line 90 C++ qgroundcontrol.exe!__tmainCRTStartup() Line 626 C qgroundcontrol.exe!mainCRTStartup() Line 466 C kernel32.dll!@BaseThreadInitThunk@12() Unknown ntdll.dll!___RtlUserThreadStart@8() Unknown ntdll.dll!__RtlUserThreadStart@8() Unknown
The reason is that at QWindowsAudioOutput::deviceReady() line 608 it is calling int l = audioSource->read(audioBuffer,input); which is a QIODevice::read() function. However, the audioBuffer is not initialized, and it is a NULL. Possibly because the QWindowsAudioOutput::close() is called before. The bug is very similar to QTBUG-8755.
The only part in my own code that comes with a audio is here:
soundWorker::soundWorker(QObject *parent) : QObject(parent) { sound = new QSound("audio/alert.wav"); sound->setLoops(2); } soundWorker::~soundWorker(){ delete sound; } void soundWorker::process() { if (sound->isFinished()) sound->play(); }
where the soundWorker is moved to another thread by calling moveToThread function.
I wonder is this a bug of Qt? Please give me some suggestions as I am quite desperate on this issue.