Crash when NXOpen objects are deleted in Unreal Engine - c++

Hello stackoverflow community,
first time asking.
I'm working on a prototype for modeling CAD data in VR with the Unreal Engine.
I have managed to get my Unreal project to build with my CAD System Siemens NX, or rather the API NXOpen.
Overall the API works and I can call NXOpen functions and can create basic objects
But some operations cause crashes and my guess is that it has something to do with memory management.
I cant wrap my head around what exactly is happening.
For example I have code that creates a NX block feature that works fine.
Afterwards I'll need a body object that is stored inside the block feature. The access also works, but when 'bodies' runs out of scope, it crashes.
Similar crashes happen when accessing all kinds of data within NX features. This dummy code triggers the crash quite often:
// 'block' gets created here
if (block) {
std::vector<NXOpen::Body*> bodies = block->GetBodies();
if (bodies.size() > 0) {
NXOpen::Body* body = bodies.front();
}
} // <-- this line crashes
Exception thrown: read access violation.
**flag** was 0xFFFFFFFFFFFFFFFF. occurred
[Inline Frame] UE4Editor-Core.dll!__TBB_machine_cmpswp1(volatile void *) Line 69 C++
> [Inline Frame] UE4Editor-Core.dll!__TBB_TryLockByte(unsigned char &) Line 917 C++
UE4Editor-Core.dll!__TBB_LockByte(unsigned char & flag) Line 924 C++
[Inline Frame] UE4Editor-Core.dll!MallocMutex::scoped_lock::{ctor}(MallocMutex &) Line 66 C++
UE4Editor-Core.dll!rml::internal::Block::freePublicObject(rml::internal::FreeObject * objectToFree) Line 1382 C++
[Inline Frame] UE4Editor-Core.dll!rml::internal::internalPoolFree(rml::internal::MemoryPool * memPool, void *) Line 2571 C++
UE4Editor-Core.dll!rml::internal::internalFree(void * object) Line 2595 C++
UE4Editor-Core.dll!FMemory::Free(void * Original) Line 76 C++
UE4Editor-GestEnUE-Win64-DebugGame.dll!operator delete(void * Ptr, unsigned __int64 Size) Line 6 C++
[External Code]
UE4Editor-GestEnUE-Win64-DebugGame.dll!UNXConnection::AddPointSetsToBody(const FString & name) Line 268 C++
UE4Editor-GestEnUE-Win64-DebugGame.dll!ANXPart::AddCylinder(FVector pos, FVector axis, float height, float diameter, bool WorldSpace) Line 103 C++
UE4Editor-GestEnUE-Win64-DebugGame.dll!ANXPart::execAddCylinder(UObject * Context, FFrame & Stack, void * const Z_Param__Result) Line 18 C++
UE4Editor-CoreUObject.dll!UFunction::Invoke(UObject * Obj, FFrame & Stack, void * const Z_Param__Result) Line 4643 C++
UE4Editor-CoreUObject.dll!UObject::CallFunction(FFrame & Stack, void * const Z_Param__Result, UFunction * Function) Line 904 C++
[Inline Frame] UE4Editor-CoreUObject.dll!FFrame::Step(UObject *) Line 319 C++
UE4Editor-CoreUObject.dll!UObject::ProcessContextOpcode(FFrame & Stack, void * const Z_Param__Result, bool bCanFailSilently) Line 2314 C++
[Inline Frame] UE4Editor-CoreUObject.dll!FFrame::Step(UObject *) Line 319 C++
UE4Editor-CoreUObject.dll!UObject::execLetObj(UObject * Context, FFrame & Stack, void * const Z_Param__Result) Line 2136 C++
[Inline Frame] UE4Editor-CoreUObject.dll!FFrame::Step(UObject *) Line 319 C++
UE4Editor-CoreUObject.dll!ProcessLocalScriptFunction(UObject * Context, FFrame & Stack, void * const Z_Param__Result) Line 974 C++
UE4Editor-CoreUObject.dll!ProcessScriptFunction<void (__cdecl*)(UObject *,FFrame &,void *)>(UObject * Context, UFunction * Function, FFrame & Stack, void * const Z_Param__Result, void(*)(UObject *, FFrame &, void *) ExecFtor) Line 809 C++
UE4Editor-CoreUObject.dll!ProcessLocalFunction(UObject * Context, UFunction * Fn, FFrame & Stack, void * const Z_Param__Result) Line 1033 C++
[Inline Frame] UE4Editor-CoreUObject.dll!FFrame::Step(UObject *) Line 319 C++
UE4Editor-CoreUObject.dll!ProcessLocalScriptFunction(UObject * Context, FFrame & Stack, void * const Z_Param__Result) Line 974 C++
UE4Editor-CoreUObject.dll!ProcessScriptFunction<void (__cdecl*)(UObject *,FFrame &,void *)>(UObject * Context, UFunction * Function, FFrame & Stack, void * const Z_Param__Result, void(*)(UObject *, FFrame &, void *) ExecFtor) Line 809 C++
UE4Editor-CoreUObject.dll!ProcessLocalFunction(UObject * Context, UFunction * Fn, FFrame & Stack, void * const Z_Param__Result) Line 1033 C++
[Inline Frame] UE4Editor-CoreUObject.dll!FFrame::Step(UObject *) Line 319 C++
UE4Editor-CoreUObject.dll!UObject::ProcessContextOpcode(FFrame & Stack, void * const Z_Param__Result, bool bCanFailSilently) Line 2314 C++
[Inline Frame] UE4Editor-CoreUObject.dll!FFrame::Step(UObject *) Line 319 C++
UE4Editor-CoreUObject.dll!ProcessLocalScriptFunction(UObject * Context, FFrame & Stack, void * const Z_Param__Result) Line 974 C++
UE4Editor-CoreUObject.dll!ProcessScriptFunction<void (__cdecl*)(UObject *,FFrame &,void *)>(UObject * Context, UFunction * Function, FFrame & Stack, void * const Z_Param__Result, void(*)(UObject *, FFrame &, void *) ExecFtor) Line 809 C++
UE4Editor-CoreUObject.dll!ProcessLocalFunction(UObject * Context, UFunction * Fn, FFrame & Stack, void * const Z_Param__Result) Line 1033 C++
[Inline Frame] UE4Editor-CoreUObject.dll!FFrame::Step(UObject *) Line 319 C++
UE4Editor-CoreUObject.dll!ProcessLocalScriptFunction(UObject * Context, FFrame & Stack, void * const Z_Param__Result) Line 974 C++
UE4Editor-CoreUObject.dll!UObject::ProcessInternal(UObject * Context, FFrame & Stack, void * const Z_Param__Result) Line 1058 C++
UE4Editor-CoreUObject.dll!UFunction::Invoke(UObject * Obj, FFrame & Stack, void * const Z_Param__Result) Line 4643 C++
UE4Editor-CoreUObject.dll!UObject::ProcessEvent(UFunction * Function, void * Parms) Line 1464 C++
UE4Editor-Engine.dll!AActor::ProcessEvent(UFunction * Function, void * Parameters) Line 769 C++
UE4Editor-GestEnUE-Win64-DebugGame.dll!ABuilderBase::commit() Line 37 C++
UE4Editor-GestEnUE-Win64-DebugGame.dll!AGestEnLeapPawn::Tick(float DeltaTime) Line 138 C++
UE4Editor-Engine.dll!AActor::TickActor(float DeltaSeconds, ELevelTick TickType, FActorTickFunction & ThisTickFunction) Line 970 C++
UE4Editor-Engine.dll!FActorTickFunction::ExecuteTick(float DeltaTime, ELevelTick TickType, ENamedThreads::Type CurrentThread, const TRefCountPtr<FGraphEvent> & MyCompletionGraphEvent) Line 164 C++
[Inline Frame] UE4Editor-Engine.dll!FTickFunctionTask::DoTask(ENamedThreads::Type) Line 285 C++
UE4Editor-Engine.dll!TGraphTask<FTickFunctionTask>::ExecuteTask(TArray<FBaseGraphTask *,FDefaultAllocator> & NewTasks, ENamedThreads::Type CurrentThread) Line 842 C++
[Inline Frame] UE4Editor-Core.dll!FBaseGraphTask::Execute(TArray<FBaseGraphTask *,FDefaultAllocator> & CurrentThread, ENamedThreads::Type) Line 511 C++
UE4Editor-Core.dll!FNamedTaskThread::ProcessTasksNamedThread(int QueueIndex, bool bAllowStall) Line 686 C++
UE4Editor-Core.dll!FNamedTaskThread::ProcessTasksUntilQuit(int QueueIndex) Line 582 C++
[Inline Frame] UE4Editor-Core.dll!FTaskGraphImplementation::ProcessThreadUntilRequestReturn(ENamedThreads::Type) Line 1406 C++
UE4Editor-Core.dll!FTaskGraphImplementation::WaitUntilTasksComplete(const TArray<TRefCountPtr<FGraphEvent>,TInlineAllocator<4,FDefaultAllocator> > & Tasks, ENamedThreads::Type CurrentThreadIfKnown) Line 1457 C++
UE4Editor-Engine.dll!FTickTaskSequencer::ReleaseTickGroup(ETickingGroup WorldTickGroup, bool bBlockTillComplete) Line 557 C++
UE4Editor-Engine.dll!FTickTaskManager::RunTickGroup(ETickingGroup Group, bool bBlockTillComplete) Line 1505 C++
UE4Editor-Engine.dll!UWorld::RunTickGroup(ETickingGroup Group, bool bBlockTillComplete) Line 789 C++
UE4Editor-Engine.dll!UWorld::Tick(ELevelTick TickType, float DeltaSeconds) Line 1568 C++
UE4Editor-UnrealEd.dll!UEditorEngine::Tick(float DeltaSeconds, bool bIdleMode) Line 1618 C++
UE4Editor-UnrealEd.dll!UUnrealEdEngine::Tick(float DeltaSeconds, bool bIdleMode) Line 403 C++
UE4Editor-Win64-DebugGame.exe!FEngineLoop::Tick() Line 3967 C++
[Inline Frame] UE4Editor-Win64-DebugGame.exe!EngineTick() Line 62 C++
UE4Editor-Win64-DebugGame.exe!GuardedMain(const wchar_t * CmdLine, HINSTANCE__ * hInInstance, HINSTANCE__ * hPrevInstance, int nCmdShow) Line 168 C++
UE4Editor-Win64-DebugGame.exe!WinMain(HINSTANCE__ * hInInstance, HINSTANCE__ * hPrevInstance, char * __formal, int nCmdShow) Line 261 C++
If I understand the callstack correctly the error occurs when the object is deleted. But why can that be the problem?
Could it be that both Unreal and the NX third party lib try to manage the memory?
Has anyone an idea what could cause these crashed and even an idea how to solve it?
I'm happy to give more information if necessary.
Greetings,
LaRanaRica

I found that using the debug runtime library often can cause memory errors when using NXOpen.
You can change this with the linker setting /MD (indstead of /MDd).

I know this is late, but I have a much better solution than to build in Release mode instead of Debug mode, because I've had this issue many times before and solved it using the same simple solution.
I don't know exactly why this occurs with NX Open C++, but it only happens when using std::vector (which some NX Open C++ APIs return) and Debug mode, together. You can fix it by adding this line to the top of your C++ source file, before all the #includes:
#define _ITERATOR_DEBUG_LEVEL 0

Related

UE4 and Azure storage sdk

I am trying to use Azure storage sdk C++ library with Unreal Engine 4 to upload images to the Azure cloud. Library is built with vcpkg and dlls are linked dynamically. Here is a simplified example of the code I use.
THIRD_PARTY_INCLUDES_START
#pragma warning(disable:4668)
#pragma warning(disable:4005) // 'TEXT': macro redefinition
#include <was/storage_account.h>
#include <was/blob.h>
#include <cpprest/filestream.h>
#include <cpprest/containerstream.h>
THIRD_PARTY_INCLUDES_END
const utility::string_t storage_connection_string(U("DefaultEndpointsProtocol=https;AccountName=myaccount;AccountKey=MyAccountKey;EndpointSuffix=core.windows.net"));
void AAwsTest2GameModeBase::StartPlay() {
try
{
// Retrieve storage account from connection string.
azure::storage::cloud_storage_account storage_account = azure::storage::cloud_storage_account::parse(storage_connection_string);
// Create the blob client.
azure::storage::cloud_blob_client blob_client = storage_account.create_cloud_blob_client();
// Retrieve a reference to a container.
azure::storage::cloud_blob_container container = blob_client.get_container_reference(U("image-container"));
azure::storage::cloud_block_blob blockBlob = container.get_block_blob_reference(U("28bbcdb0b3e5417b207572e292ae98412cd9d931eae6266f7c4fd788ad8544a20.jpg"));
concurrency::streams::istream input_stream = concurrency::streams::file_stream<uint8_t>::open_istream(U("image.jpg")).get();
blockBlob.upload_from_stream(input_stream);
input_stream.close().wait();
}
catch (const std::exception& e)
{
std::wcout << U("Error: ") << e.what() << std::endl;
}
}
Build.cs content
public class Program : ModuleRules
{
public Program(ReadOnlyTargetRules Target) : base(Target)
{
PCHUsage = PCHUsageMode.UseExplicitOrSharedPCHs;
PublicDependencyModuleNames.AddRange(new string[] { "Core", "CoreUObject", "Engine", "InputCore" });
//I tried to use ansi allocator but it did not help
//PublicDefinitions.Add("FORCE_ANSI_ALLOCATOR");
PublicIncludePaths.Add(Path.Combine(DependencyFolderWin, "include"));
PublicAdditionalLibraries.Add(Path.Combine(DependencyFolderWin, "lib", "wastorage.lib"));
PublicAdditionalLibraries.Add(Path.Combine(DependencyFolderWin, "lib", "cpprest_2_10.lib"));
PublicAdditionalLibraries.Add(Path.Combine(DependencyFolderWin, "lib", "brotlicommon.lib"));
PublicAdditionalLibraries.Add(Path.Combine(DependencyFolderWin, "lib", "brotlidec.lib"));
PublicAdditionalLibraries.Add(Path.Combine(DependencyFolderWin, "lib", "brotlienc.lib"));
PublicAdditionalLibraries.Add(Path.Combine(DependencyFolderWin, "lib", "zlib.lib"));
}
private string DependencyFolderWin
{
get
{
string moduleDir = Path.GetFullPath(ModuleDirectory);
return Path.Combine(moduleDir, "./../../deps");
}
}
}
The problem is that it successfully uploads image and crashes right after return from this function (in this case StartPlay() or Upload() as in the callstack) with this callstack:
UE4Editor-Core.dll!00007ff9e620ff1b() Unknown
UE4Editor-Core.dll!00007ff9e62109e3() Unknown
UE4Editor-Core.dll!00007ff9e6211592() Unknown
UE4Editor-Core.dll!00007ff9e5e95277() Unknown
[Inline Frame] UE4Editor-MsgQueuePlugin.dll!operator delete(void *) Line 31 C++
[Inline Frame] UE4Editor-MsgQueuePlugin.dll!std::_Deallocate(void * _Ptr, unsigned __int64 _Bytes) Line 207 C++
[Inline Frame] UE4Editor-MsgQueuePlugin.dll!std::allocator<wchar_t>::deallocate(wchar_t * const) Line 992 C++
UE4Editor-MsgQueuePlugin.dll!std::basic_string<wchar_t,std::char_traits<wchar_t>,std::allocator<wchar_t> >::_Tidy_deallocate() Line 3992 C++
[Inline Frame] UE4Editor-MsgQueuePlugin.dll!std::basic_string<wchar_t,std::char_traits<wchar_t>,std::allocator<wchar_t> >::{dtor}() Line 2460 C++
UE4Editor-MsgQueuePlugin.dll!web::uri::~uri() C++
UE4Editor-MsgQueuePlugin.dll!azure::storage::cloud_blob::~cloud_blob() C++
UE4Editor-MsgQueuePlugin.dll!AzureUploader::Upload(TArray<unsigned char,FDefaultAllocator> file, const std::basic_string<char,std::char_traits<char>,std::allocator<char> > & path, const std::basic_string<char,std::char_traits<char>,std::allocator<char> > & fileName) Line 37 C++
Callstack with Editor debug symbols:
[Inline Frame] UE4Editor-Core.dll!__TBB_machine_cmpswp1(volatile void *) Line 69 C++
[Inline Frame] UE4Editor-Core.dll!__TBB_TryLockByte(unsigned char &) Line 917 C++
UE4Editor-Core.dll!__TBB_LockByte(unsigned char & flag) Line 924 C++
[Inline Frame] UE4Editor-Core.dll!MallocMutex::scoped_lock::{ctor}(MallocMutex &) Line 66 C++
UE4Editor-Core.dll!rml::internal::Block::freePublicObject(rml::internal::FreeObject * objectToFree) Line 1382 C++
[Inline Frame] UE4Editor-Core.dll!rml::internal::internalPoolFree(rml::internal::MemoryPool * memPool, void *) Line 2571 C++
UE4Editor-Core.dll!rml::internal::internalFree(void * object) Line 2595 C++
UE4Editor-Core.dll!FMemory::Free(void * Original) Line 76 C++
[External Code]
UE4Editor-MsgQueuePlugin.dll!AzureUploader::Upload(TArray<unsigned char,FDefaultAllocator> file, const std::basic_string<char,std::char_traits<char>,std::allocator<char> > & path, const std::basic_string<char,std::char_traits<char>,std::allocator<char> > & fileName) Line 37 C++
Looks like it crashes while deleting uri from some structure. Probably, the problem is with unreal memory management. I tried to use ansi allocator but it did not help. Any ideas how to make it work properly?
Thank you
Finally, it was solved by using UE4 plugin from this example. It is not the solution I wanted but at least it works. There are statically linked libraries and hardcoded compiler version which may bring problems in the future.

QProgressDialog::setValue produces random stack overflows

I am working on developing a big project that cannot share the source code. In that project, we are getting some poorly reproducible stack overflow errors in windows (not in ubuntu) and the stack trace of the debugger shows that the progress dialog set to window modal, is calling QProgressDialog::setValue(int) recursively.
I have created this small example of a QProgressDialog to try to reproduce the error. Although I have not gotten into a stack overflow error using this example (neither in Windows or Ubuntu), when I look into QProgressDailog::setValue by adding a breakpoint in the debugger, I see that it also calls itself recursively (in both OS), just not enough times to produce the stack overflow. The most impressive thing is that sometimes it does call the QPrigressDialog::setValue only once.
See an example of the call stack or windows:
Qt5Widgets.dll!QProgressDialog::setValue(int progress) Line 653 C++
[Inline Frame] Qt5Core.dll!QtPrivate::QSlotObjectBase::call(QObject *) Line 398 C++
Qt5Core.dll!QMetaCallEvent::placeMetaCall(QObject * object) Line 626 C++
Qt5Core.dll!QObject::event(QEvent * e) Line 1339 C++
Qt5Widgets.dll!QWidget::event(QEvent * event) Line 9094 C++
Qt5Widgets.dll!QApplicationPrivate::notify_helper(QObject * receiver, QEvent * e) Line 3687 C++
Qt5Widgets.dll!QApplication::notify(QObject * receiver, QEvent * e) Line 3639 C++
Qt5Core.dll!QCoreApplication::notifyInternal2(QObject * receiver, QEvent * event) Line 1075 C++
[Inline Frame] Qt5Core.dll!QCoreApplication::sendEvent(QObject *) Line 1470 C++
Qt5Core.dll!QCoreApplicationPrivate::sendPostedEvents(QObject * receiver, int event_type, QThreadData * data) Line 1815 C++
qwindows.dll!QWindowsGuiEventDispatcher::sendPostedEvents() Line 82 C++
Qt5Core.dll!QEventDispatcherWin32::processEvents(QFlags<enum QEventLoop::ProcessEventsFlag> flags) Line 525 C++
qwindows.dll!QWindowsGuiEventDispatcher::processEvents(QFlags<enum QEventLoop::ProcessEventsFlag> flags) Line 75 C++
Qt5Widgets.dll!QProgressDialog::setValue(int progress) Line 663 C++
[Inline Frame] Qt5Core.dll!QtPrivate::QSlotObjectBase::call(QObject *) Line 398 C++
Qt5Core.dll!QMetaCallEvent::placeMetaCall(QObject * object) Line 626 C++
Qt5Core.dll!QObject::event(QEvent * e) Line 1339 C++
Qt5Widgets.dll!QWidget::event(QEvent * event) Line 9094 C++
Qt5Widgets.dll!QApplicationPrivate::notify_helper(QObject * receiver, QEvent * e) Line 3687 C++
Qt5Widgets.dll!QApplication::notify(QObject * receiver, QEvent * e) Line 3639 C++
Qt5Core.dll!QCoreApplication::notifyInternal2(QObject * receiver, QEvent * event) Line 1075 C++
[Inline Frame] Qt5Core.dll!QCoreApplication::sendEvent(QObject *) Line 1470 C++
Qt5Core.dll!QCoreApplicationPrivate::sendPostedEvents(QObject * receiver, int event_type, QThreadData * data) Line 1815 C++
qwindows.dll!QWindowsGuiEventDispatcher::sendPostedEvents() Line 82 C++
Qt5Core.dll!QEventDispatcherWin32::processEvents(QFlags<enum QEventLoop::ProcessEventsFlag> flags) Line 525 C++
qwindows.dll!QWindowsGuiEventDispatcher::processEvents(QFlags<enum QEventLoop::ProcessEventsFlag> flags) Line 75 C++
Qt5Widgets.dll!QProgressDialog::setValue(int progress) Line 663 C++
[Inline Frame] Qt5Core.dll!QtPrivate::QSlotObjectBase::call(QObject *) Line 398 C++
Qt5Core.dll!QMetaCallEvent::placeMetaCall(QObject * object) Line 626 C++
Qt5Core.dll!QObject::event(QEvent * e) Line 1339 C++
Qt5Widgets.dll!QWidget::event(QEvent * event) Line 9094 C++
Qt5Widgets.dll!QApplicationPrivate::notify_helper(QObject * receiver, QEvent * e) Line 3687 C++
Qt5Widgets.dll!QApplication::notify(QObject * receiver, QEvent * e) Line 3639 C++
Qt5Core.dll!QCoreApplication::notifyInternal2(QObject * receiver, QEvent * event) Line 1075 C++
[Inline Frame] Qt5Core.dll!QCoreApplication::sendEvent(QObject *) Line 1470 C++
Qt5Core.dll!QCoreApplicationPrivate::sendPostedEvents(QObject * receiver, int event_type, QThreadData * data) Line 1815 C++
qwindows.dll!QWindowsGuiEventDispatcher::sendPostedEvents() Line 82 C++
Qt5Core.dll!QEventDispatcherWin32::processEvents(QFlags<enum QEventLoop::ProcessEventsFlag> flags) Line 525 C++
qwindows.dll!QWindowsGuiEventDispatcher::processEvents(QFlags<enum QEventLoop::ProcessEventsFlag> flags) Line 75 C++
Qt5Widgets.dll!QProgressDialog::setValue(int progress) Line 663 C++
[Inline Frame] Qt5Core.dll!QtPrivate::QSlotObjectBase::call(QObject *) Line 398 C++
Qt5Core.dll!QMetaCallEvent::placeMetaCall(QObject * object) Line 626 C++
Qt5Core.dll!QObject::event(QEvent * e) Line 1339 C++
Qt5Widgets.dll!QWidget::event(QEvent * event) Line 9094 C++
Qt5Widgets.dll!QApplicationPrivate::notify_helper(QObject * receiver, QEvent * e) Line 3687 C++
Qt5Widgets.dll!QApplication::notify(QObject * receiver, QEvent * e) Line 3639 C++
Qt5Core.dll!QCoreApplication::notifyInternal2(QObject * receiver, QEvent * event) Line 1075 C++
[Inline Frame] Qt5Core.dll!QCoreApplication::sendEvent(QObject *) Line 1470 C++
Qt5Core.dll!QCoreApplicationPrivate::sendPostedEvents(QObject * receiver, int event_type, QThreadData * data) Line 1815 C++
qwindows.dll!QWindowsGuiEventDispatcher::sendPostedEvents() Line 82 C++
Qt5Core.dll!QEventDispatcherWin32::processEvents(QFlags<enum QEventLoop::ProcessEventsFlag> flags) Line 525 C++
qwindows.dll!QWindowsGuiEventDispatcher::processEvents(QFlags<enum QEventLoop::ProcessEventsFlag> flags) Line 75 C++
Qt5Widgets.dll!QProgressDialog::setValue(int progress) Line 663 C++
[Inline Frame] Qt5Core.dll!QtPrivate::QSlotObjectBase::call(QObject *) Line 398 C++
Qt5Core.dll!QMetaCallEvent::placeMetaCall(QObject * object) Line 626 C++
Qt5Core.dll!QObject::event(QEvent * e) Line 1339 C++
Qt5Widgets.dll!QWidget::event(QEvent * event) Line 9094 C++
Qt5Widgets.dll!QApplicationPrivate::notify_helper(QObject * receiver, QEvent * e) Line 3687 C++
Qt5Widgets.dll!QApplication::notify(QObject * receiver, QEvent * e) Line 3639 C++
Qt5Core.dll!QCoreApplication::notifyInternal2(QObject * receiver, QEvent * event) Line 1075 C++
[Inline Frame] Qt5Core.dll!QCoreApplication::sendEvent(QObject *) Line 1470 C++
Qt5Core.dll!QCoreApplicationPrivate::sendPostedEvents(QObject * receiver, int event_type, QThreadData * data) Line 1815 C++
qwindows.dll!QWindowsGuiEventDispatcher::sendPostedEvents() Line 82 C++
Qt5Core.dll!QEventDispatcherWin32::processEvents(QFlags<enum QEventLoop::ProcessEventsFlag> flags) Line 525 C++
qwindows.dll!QWindowsGuiEventDispatcher::processEvents(QFlags<enum QEventLoop::ProcessEventsFlag> flags) Line 75 C++
Qt5Widgets.dll!QProgressDialog::setValue(int progress) Line 663 C++
[Inline Frame] Qt5Core.dll!QtPrivate::QSlotObjectBase::call(QObject *) Line 398 C++
Qt5Core.dll!QMetaCallEvent::placeMetaCall(QObject * object) Line 626 C++
Qt5Core.dll!QObject::event(QEvent * e) Line 1339 C++
Qt5Widgets.dll!QWidget::event(QEvent * event) Line 9094 C++
Qt5Widgets.dll!QApplicationPrivate::notify_helper(QObject * receiver, QEvent * e) Line 3687 C++
Qt5Widgets.dll!QApplication::notify(QObject * receiver, QEvent * e) Line 3639 C++
Qt5Core.dll!QCoreApplication::notifyInternal2(QObject * receiver, QEvent * event) Line 1075 C++
[Inline Frame] Qt5Core.dll!QCoreApplication::sendEvent(QObject *) Line 1470 C++
Qt5Core.dll!QCoreApplicationPrivate::sendPostedEvents(QObject * receiver, int event_type, QThreadData * data) Line 1815 C++
qwindows.dll!QWindowsGuiEventDispatcher::sendPostedEvents() Line 82 C++
Qt5Core.dll!QEventDispatcherWin32::processEvents(QFlags<enum QEventLoop::ProcessEventsFlag> flags) Line 525 C++
qwindows.dll!QWindowsGuiEventDispatcher::processEvents(QFlags<enum QEventLoop::ProcessEventsFlag> flags) Line 75 C++
Qt5Widgets.dll!QProgressDialog::setValue(int progress) Line 663 C++
[Inline Frame] Qt5Core.dll!QtPrivate::QSlotObjectBase::call(QObject *) Line 398 C++
Qt5Core.dll!QMetaCallEvent::placeMetaCall(QObject * object) Line 626 C++
Qt5Core.dll!QObject::event(QEvent * e) Line 1339 C++
Qt5Widgets.dll!QWidget::event(QEvent * event) Line 9094 C++
Qt5Widgets.dll!QApplicationPrivate::notify_helper(QObject * receiver, QEvent * e) Line 3687 C++
Qt5Widgets.dll!QApplication::notify(QObject * receiver, QEvent * e) Line 3639 C++
Qt5Core.dll!QCoreApplication::notifyInternal2(QObject * receiver, QEvent * event) Line 1075 C++
[Inline Frame] Qt5Core.dll!QCoreApplication::sendEvent(QObject *) Line 1470 C++
Qt5Core.dll!QCoreApplicationPrivate::sendPostedEvents(QObject * receiver, int event_type, QThreadData * data) Line 1815 C++
qwindows.dll!QWindowsGuiEventDispatcher::sendPostedEvents() Line 82 C++
Qt5Core.dll!QEventDispatcherWin32::processEvents(QFlags<enum QEventLoop::ProcessEventsFlag> flags) Line 525 C++
qwindows.dll!QWindowsGuiEventDispatcher::processEvents(QFlags<enum QEventLoop::ProcessEventsFlag> flags) Line 75 C++
[Inline Frame] Qt5Core.dll!QEventLoop::processEvents(QFlags<enum QEventLoop::ProcessEventsFlag>) Line 138 C++
Qt5Core.dll!QEventLoop::exec(QFlags<enum QEventLoop::ProcessEventsFlag> flags) Line 225 C++
Qt5Core.dll!QCoreApplication::exec() Line 1383 C++
progress_bar.exe!main(int argc, char * * argv) Line 9 C++
[External Code]
See an example of the call stack on ubuntu:
#0 0x00007ffff76fa330 in QProgressDialog::setValue(int) () at /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
#1 0x00007ffff60a3dec in QtPrivate::FunctorCall<QtPrivate::IndexesList<0>, QtPrivate::List<int>, void, void (QProgressDialog::*)(int)>::call(void (QProgressDialog::*)(int), QProgressDialog*, void**) ()
at /home/apalomer/programming_workspace/progress_bar_example/build/libthreadedworker.so
#2 0x00007ffff60a3ba4 in void QtPrivate::FunctionPointer<void (QProgressDialog::*)(int)>::call<QtPrivate::List<int>, void>(void (QProgressDialog::*)(int), QProgressDialog*, void**) ()
at /home/apalomer/programming_workspace/progress_bar_example/build/libthreadedworker.so
#3 0x00007ffff60a3759 in QtPrivate::QSlotObject<void (QProgressDialog::*)(int), QtPrivate::List<int>, void>::impl(int, QtPrivate::QSlotObjectBase*, QObject*, void**, bool*) ()
at /home/apalomer/programming_workspace/progress_bar_example/build/libthreadedworker.so
#4 0x00007ffff6ef30c2 in QObject::event(QEvent*) (this=0x555555b74610, e=<optimized out>) at kernel/qobject.cpp:1247
#5 0x00007ffff751775b in QWidget::event(QEvent*) () at /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
#6 0x00007ffff74d883c in QApplicationPrivate::notify_helper(QObject*, QEvent*) () at /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
#7 0x00007ffff74e0104 in QApplication::notify(QObject*, QEvent*) () at /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
#8 0x00007ffff6ec38d8 in QCoreApplication::notifyInternal2(QObject*, QEvent*) (receiver=0x555555b74610, event=event#entry=0x7fffc80037a0) at kernel/qcoreapplication.cpp:1024
#9 0x00007ffff6ec604d in QCoreApplication::sendEvent(QObject*, QEvent*) (event=0x7fffc80037a0, receiver=<optimized out>) at ../../include/QtCore/../../src/corelib/kernel/qcoreapplication.h:233
#10 0x00007ffff6ec604d in QCoreApplicationPrivate::sendPostedEvents(QObject*, int, QThreadData*) (receiver=receiver#entry=0x0, event_type=event_type#entry=0, data=0x55555576fef0)
at kernel/qcoreapplication.cpp:1699
#11 0x00007ffff6ec65d8 in QCoreApplication::sendPostedEvents(QObject*, int) (receiver=receiver#entry=0x0, event_type=event_type#entry=0) at kernel/qcoreapplication.cpp:1553
#12 0x00007ffff6f1d263 in postEventSourceDispatch(GSource*, GSourceFunc, gpointer) (s=0x5555558952a0) at kernel/qeventdispatcher_glib.cpp:276
#13 0x00007ffff4221417 in g_main_context_dispatch () at /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0
#14 0x00007ffff4221650 in () at /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0
#15 0x00007ffff42216dc in g_main_context_iteration () at /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0
#16 0x00007ffff6f1c88f in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) (this=0x5555558d2b80, flags=...) at kernel/qeventdispatcher_glib.cpp:423
#17 0x00007ffff76fa4c7 in QProgressDialog::setValue(int) () at /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
#18 0x00007ffff60a3dec in QtPrivate::FunctorCall<QtPrivate::IndexesList<0>, QtPrivate::List<int>, void, void (QProgressDialog::*)(int)>::call(void (QProgressDialog::*)(int), QProgressDialog*, void**) ()
at /home/apalomer/programming_workspace/progress_bar_example/build/libthreadedworker.so
#19 0x00007ffff60a3ba4 in void QtPrivate::FunctionPointer<void (QProgressDialog::*)(int)>::call<QtPrivate::List<int>, void>(void (QProgressDialog::*)(int), QProgressDialog*, void**) ()
at /home/apalomer/programming_workspace/progress_bar_example/build/libthreadedworker.so
#20 0x00007ffff60a3759 in QtPrivate::QSlotObject<void (QProgressDialog::*)(int), QtPrivate::List<int>, void>::impl(int, QtPrivate::QSlotObjectBase*, QObject*, void**, bool*) ()
at /home/apalomer/programming_workspace/progress_bar_example/build/libthreadedworker.so
#21 0x00007ffff6ef30c2 in QObject::event(QEvent*) (this=0x555555b74610, e=<optimized out>) at kernel/qobject.cpp:1247
#22 0x00007ffff751775b in QWidget::event(QEvent*) () at /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
#23 0x00007ffff74d883c in QApplicationPrivate::notify_helper(QObject*, QEvent*) () at /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
#24 0x00007ffff74e0104 in QApplication::notify(QObject*, QEvent*) () at /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
#25 0x00007ffff6ec38d8 in QCoreApplication::notifyInternal2(QObject*, QEvent*) (receiver=0x555555b74610, event=event#entry=0x7fffc8002ef0) at kernel/qcoreapplication.cpp:1024
#26 0x00007ffff6ec604d in QCoreApplication::sendEvent(QObject*, QEvent*) (event=0x7fffc8002ef0, receiver=<optimized out>) at ../../include/QtCore/../../src/corelib/kernel/qcoreapplication.h:233
#27 0x00007ffff6ec604d in QCoreApplicationPrivate::sendPostedEvents(QObject*, int, QThreadData*) (receiver=receiver#entry=0x0, event_type=event_type#entry=0, data=0x55555576fef0)
at kernel/qcoreapplication.cpp:1699
#28 0x00007ffff6ec65d8 in QCoreApplication::sendPostedEvents(QObject*, int) (receiver=receiver#entry=0x0, event_type=event_type#entry=0) at kernel/qcoreapplication.cpp:1553
#29 0x00007ffff6f1d263 in postEventSourceDispatch(GSource*, GSourceFunc, gpointer) (s=0x5555558952a0) at kernel/qeventdispatcher_glib.cpp:276
#30 0x00007ffff4221417 in g_main_context_dispatch () at /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0
#31 0x00007ffff4221650 in () at /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0
#32 0x00007ffff42216dc in g_main_context_iteration () at /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0
#33 0x00007ffff6f1c88f in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) (this=0x5555558d2b80, flags=...) at kernel/qeventdispatcher_glib.cpp:423
#34 0x00007ffff6ec190a in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) (this=this#entry=0x7fffffffcfb0, flags=..., flags#entry=...) at kernel/qeventloop.cpp:212
#35 0x00007ffff6eca9b4 in QCoreApplication::exec() () at kernel/qcoreapplication.cpp:1297
#36 0x0000555555554cb4 in main ()
Any ideas on how to fix this recursion? Should I move it to a bug report? It happens especially if I manually step through the program.
I have tested this in Windows 10, Visual Studio 16.5.2, MSVC 19.25.28612.0 and Qt 5.14.2 as well as Qt 5.14.1, Qt 5.9.5. Also, I have tried in Ubuntu 18.04, g++ 7.5.0 and Qt 5.9.5.
From what I can gather from your sample code:
There is one worker thread posting events to the main event queues every 200ms. (As the signal emitted from the worker thread is on a queued connection, this will post an event in the receiver's thread event loop)
The QProgressDialog source code shows clearly that it calls QCoreApplication::processEvents in its setValue methods when configured in modal mode.
So, to induce a stack overflow, one thread should have been capable of posting enough events in the dialog's thread event loop before the dialog begins to process them.
Once it will begin to process this events chain, it will recurse on itself and may cause a stack overflow. If you are stepping in the main thread with the debugger, it may explains why the other thread is able to accumulate so much events in the main even loop.
I do not know it this is something that may qualify as a bug for the Qt project, but you could still ask on their IRC channel or open an issue and see where it gets.
Nevertheless, a possible ad-hoc solution would be to avoid bursting signals from the worker thread to avoid falling in this pitfall (like triggering a status update every second instead on short unoticeable intervals for the end user).

Process hangs on WinHttpReceiveResponse()

My process hangs with the below callstack at WinHttpRecieveResponse(). This behaviour is inconsistent sometime it works for the same data and same use case. But most of the time it hangs likes below.
I have checked using the WireShark that response is received on machine. I can find the response in Wireshark. But the WinHttpRecieveResponse() is not able to receive that data.
Please help me to find the issue.
ntdll.dll!ZwWaitForSingleObject() Unknown
KernelBase.dll!WaitForSingleObjectEx() Unknown
winhttp.dll!HTTP_USER_REQUEST::_HandleSyncPending(class PENDING_API_CALL *,unsigned long *) Unknown
winhttp.dll!HTTP_USER_REQUEST::RecvResponse(int,void (*)(void *,unsigned __int64,unsigned long,void *,unsigned long),unsigned long,unsigned __int64) Unknown
winhttp.dll!WinHttpReceiveResponse() Unknown
atimport.dll!winHTTPStream::DoWaitForResponse(btkTimeval waitTime) Line 525 C++
atimport.dll!btkHTTPStreamBase::IsResponse(btkTimeval Timeout) Line 301 C++
atimport.dll!btkHTTPStreamBase::CompleteOutput(bool Blocking) Line 608 C++
atimport.dll!UwgmServerCache_i::executeHttpRequest(btkHTTPStreamBase * connection, xstring & responseStr, xstring reqBody) Line 11207 C++
atimport.dll!UwgmUploadAction_i::getChapteredUploadDescriptorsFromServer() Line 4480 C++
atimport.dll!UwgmUploadAction_i::prepareForUpload() Line 4557 C++
atimport.dll!UwgmUploadAction_i::onWorkspaceActionStart() Line 6401 C++
atimport.dll!UwgmWorkspaceModificationAction_i::onWorkspaceModificationActionStart() Line 6965 C++
atimport.dll!UwgmWorkspaceAction_i::onStart() Line 3689 C++
atimport.dll!UwgmAction_i::run() Line 636 C++
atimport.dll!UwgmAction_i::start(xstring msg) Line 580 C++
atimport.dll!UwgmAction_i::execute(xstring msg) Line 494 C++
atimport.dll!UwgmAction_i::execute() Line 489 C++
atimport.dll!atwncintBaseUtils_uwgmcc::executeAction(xrchandle<UwgmClientConnectorAction> ccAction, xstring logStr) Line 533 C++
atimport.dll!atwncintWorkspace_uwgmcc::upload(xrchandle<UwgmUploadAction> uploader) Line 1166 C++
atimport.dll!atwncintWorkspace_uwgmcc::upload(xrchandle<xstringsequence> docCadNames, atwncintGhostResolutionOption ghostResolutionOption) Line 1231 C++
atimport.dll!atwncintWorkspace_uwgmcc::checkin(xrchandle<xstringsequence> docCadNames, xrchandle<xstringsequence> targetFolderPaths, const char * comment, xrchandle<atwncintPostCheckinOptionDict> postCheckinOpts, xrchandle<atwncintBaselineInfo> baseline, xrchandle<xstringsequence> addToBaselineNames, atwncintGhostResolutionOption ghostResolutionOption) Line 1324 C++
atimport.dll!Java_com_ptc_prowt_Implementation_atwncint_1k03_00024Workspace_checkin(JNIEnv_ * _env, _jobject * _self, _jobject * docNames, _jobject * targetFolderPaths, _jstring * comment, _jobject * postCheckinOptions, _jobject * baseline, _jobject * addToBaselineNames, _jobject * ghostResolutionOption) Line 8657 C++
000000000a681df0() Unknown
000000000513d9f8() Unknown
0000000000533468() Unknown
000000002b64d490() Unknown
000000002b7fde38() Unknown
Found the solution for this problem.
Actually before this call there was bufferoverflow which was corrupting my heap.
Fixing the bufferoverflow solved my problem.

Crash in QString toUtf8()

I have a slot:
void Foo::func(QString str1, const QString& str2, int width, int height)
{
std::unique_lock<std::mutex> _lock(m_mutex);
#ifdef _DEBUG
MEMORYSTATUSEX statex;
statex.dwLength = sizeof (statex);
if (GlobalMemoryStatusEx(&statex)) {
qDebug() << QString("There are %1 free MB of physical memory.\n").arg(statex.ullAvailPhys / 1024 / 1024);
}
#endif
BaseClass::someFunc(
str1.toStdString(),
str2.toUtf8().constData(),
width,
height
);
}
It seems to be correct and it works. But if program works for a long time (night for example) it crashes in this function at line
str2.toUtf8().constData()
I first thought that this is a thread-based error, but my lock didn't work. All the local variables and class members are ok. The crash error is:
First-chance exception at 0x76E45B68 foo.exe: Microsoft C++ exception: std::bad_alloc at memory location 0x00EFC6EC
But from the code above last MEMORYSTATUSEX show that available memory is
There are 2314 free MB of physical memory
I also thought that str2 is too big, but it works fine with length of 49152, 168441 etc. What is the problem? Did I miss something?
Stack Trace:
KernelBase.dll!_RaiseException#16() Unknown
[External Code]
Qt5Cored.dll!qBadAlloc() Line 2849 C++
Qt5Cored.dll!QByteArray::QByteArray(int size, Qt::Initialization __formal) Line 1409 C++
Qt5Cored.dll!QUtf8::convertFromUnicode(const QChar * uc, int len) Line 151 C++
Qt5Cored.dll!QString::toUtf8_helper(const QString & str) Line 4373 C++
Qt5Cored.dll!QString::toUtf8() Line 56 C++
foo.exe!Foo::func(QString str1, const QString & str2, int width, int height) Line 3600 C++
foo.exe!Foo::qt_static_metacall(QObject * _o, QMetaObject::Call _c, int _id, void * * _a) Line 1126 C++
Qt5Cored.dll!QMetaObject::activate(QObject * sender, int signalOffset, int local_signal_index, void * * argv) Line 3717 C++
Qt5Cored.dll!QMetaObject::activate(QObject * sender, const QMetaObject * m, int local_signal_index, void * * argv) Line 3582 C++
foo.exe!SomeClass::func(QString _t1, const QString & _t2, int _t3, int _t4) Line 137 C++
foo.exe!SomeClass::qt_static_metacall(QObject * _o, QMetaObject::Call _c, int _id, void * * _a) Line 81 C++
Qt5Cored.dll!QMetaCallEvent::placeMetaCall(QObject * object) Line 485 C++
Qt5Cored.dll!QObject::event(QEvent * e) Line 1246 C++
Qt5Widgetsd.dll!QApplicationPrivate::notify_helper(QObject * receiver, QEvent * e) Line 3720 C++
Qt5Widgetsd.dll!QApplication::notify(QObject * receiver, QEvent * e) Line 3164 C++
Qt5Cored.dll!QCoreApplication::notifyInternal(QObject * receiver, QEvent * event) Line 935 C++
Qt5Cored.dll!QCoreApplication::sendEvent(QObject * receiver, QEvent * event) Line 228 C++
Qt5Cored.dll!QCoreApplicationPrivate::sendPostedEvents(QObject * receiver, int event_type, QThreadData * data) Line 1552 C++
Qt5Cored.dll!QCoreApplication::sendPostedEvents(QObject * receiver, int event_type) Line 1410 C++
qwindowsd.dll!QWindowsGuiEventDispatcher::sendPostedEvents() Line 81 C++
Qt5Cored.dll!qt_internal_proc(HWND__ * hwnd, unsigned int message, unsigned int wp, long lp) Line 414 C++
[External Code]
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++
foo.exe!WinMain(HINSTANCE__ * __formal, HINSTANCE__ * __formal, char * lpCmdLine, int __formal) Line 348 C++
[External Code]
Thanks in advance!
For those who, like me, just stumbled on this thread because they wanted to convert a QString into a char * with a call to str.toUtf8().constData() or str.toUtf8().data(), but that was leading a program to crash or to throw an exception like EXC_BAD_ACCESS on XCode, here's the answer:
in a call like foo = str.toUtf8().constData();, the str.toUtf8() part creates a temp object.
a call to tmp.data() or tmp.constData() return a pointer to an internal buffer managed by the object itself, and whose lifetime is tied to the temp object's lifetime. source.
once that statement is executed, the lifetime of the object whose address was assigned to foo, once returned by data() or constData(), will end.
therefore, as expected, after that statement foo will hold an address to an object whose lifetime ended, thus causing crashes and exceptions.

QT application crashes on startup (c++ windows)

I have the source code f a qt application which was written by somebody else who is not with my company anymore.
I managed to compile the code using qt 4.8.4. I found that original version used qt 4.7.3.
When I run application it crashes just after start-up inside one of the qt DLL.
I am developing on windows7 x64, but target is x86. I am using VS 2012 and compiled qt using VS 2012.
Do I need to set anything environment variable for QT to work properly?
Do I need to install any other software (such as opengl or any other library that qt relays on them)?
Edit 1
The stack after crashing is:
QtOpenGLd4.dll!QGLContextPrivate::extensionFuncs(const QGLContext * ctx) Line 467 C++
QtOpenGLd4.dll!qt_resolve_glsl_extensions(QGLContext * ctx) Line 257 C++
QtOpenGLd4.dll!QGLShaderPrivate::create() Line 227 C++
QtOpenGLd4.dll!QGLShader::QGLShader(QFlags<enum QGLShader::ShaderTypeBit> type, const QGLContext * context, QObject * parent) Line 342 C++
QtOpenGLd4.dll!QGLEngineSharedShaders::QGLEngineSharedShaders(const QGLContext * context) Line 191 C++
QtOpenGLd4.dll!QGLContextGroupResource<QGLEngineSharedShaders>::value(const QGLContext * context) Line 777 C++
QtOpenGLd4.dll!QGLShaderStorage::shadersForThread(const QGLContext * context) Line 63 C++
QtOpenGLd4.dll!QGLEngineSharedShaders::shadersForContext(const QGLContext * context) Line 74 C++
QtOpenGLd4.dll!QGLEngineShaderManager::QGLEngineShaderManager(QGLContext * context) Line 467 C++
QtOpenGLd4.dll!QGL2PaintEngineEx::begin(QPaintDevice * pdev) Line 2150 C++
QtGuid4.dll!QPainter::begin(QPaintDevice * pd) Line 1881 C++
QtGuid4.dll!QPainter::QPainter(QPaintDevice * pd) Line 1508 C++
myapp.exe!SViewer::paintEvent(QPaintEvent * __formal) Line 187 C++
QtGuid4.dll!QWidget::event(QEvent * event) Line 8533 C++
QtOpenGLd4.dll!QGLWidget::event(QEvent * e) Line 4408 C++
QtGuid4.dll!QApplicationPrivate::notify_helper(QObject * receiver, QEvent * e) Line 4562 C++
QtGuid4.dll!QApplication::notify(QObject * receiver, QEvent * e) Line 4527 C++
QtCored4.dll!QCoreApplication::notifyInternal(QObject * receiver, QEvent * event) Line 946 C++
QtCored4.dll!QCoreApplication::sendSpontaneousEvent(QObject * receiver, QEvent * event) Line 234 C++
QtGuid4.dll!QWidgetPrivate::drawWidget(QPaintDevice * pdev, const QRegion & rgn, const QPoint & offset, int flags, QPainter * sharedPainter, QWidgetBackingStore * backingStore) Line 5598 C++
QtGuid4.dll!QWidgetPrivate::repaint_sys(const QRegion & rgn) Line 1659 C++
QtGuid4.dll!QWidgetPrivate::syncBackingStore() Line 1894 C++
QtGuid4.dll!QWidget::event(QEvent * event) Line 8680 C++
QtOpenGLd4.dll!QGLWidget::event(QEvent * e) Line 4408 C++
QtGuid4.dll!QApplicationPrivate::notify_helper(QObject * receiver, QEvent * e) Line 4562 C++
QtGuid4.dll!QApplication::notify(QObject * receiver, QEvent * e) Line 4527 C++
QtCored4.dll!QCoreApplication::notifyInternal(QObject * receiver, QEvent * event) Line 946 C++
QtCored4.dll!QCoreApplication::sendEvent(QObject * receiver, QEvent * event) Line 231 C++
QtCored4.dll!QCoreApplicationPrivate::sendPostedEvents(QObject * receiver, int event_type, QThreadData * data) Line 1570 C++
QtCored4.dll!qt_internal_proc(HWND__ * hwnd, unsigned int message, unsigned int wp, long lp) Line 496 C++
user32.dll!75ce62fa() Unknown
[Frames below may be incorrect and/or missing, no symbols loaded for user32.dll]
user32.dll!75ce6d3a() Unknown
user32.dll!75ce6ce9() Unknown
user32.dll!75ce77c4() Unknown
user32.dll!75ce788a() Unknown
QtCored4.dll!QEventDispatcherWin32::processEvents(QFlags<enum QEventLoop::ProcessEventsFlag> flags) Line 810 C++
QtGuid4.dll!QGuiEventDispatcherWin32::processEvents(QFlags<enum QEventLoop::ProcessEventsFlag> flags) Line 1204 C++
QtCored4.dll!QEventLoop::processEvents(QFlags<enum QEventLoop::ProcessEventsFlag> flags) Line 150 C++
QtCored4.dll!QEventLoop::exec(QFlags<enum QEventLoop::ProcessEventsFlag> flags) Line 204 C++
QtGuid4.dll!QDialog::exec() Line 555 C++
myapp.exe!MainWindow::actionWelcomeDialog() Line 1078 C++
myapp.exe!MainWindow::qt_static_metacall(QObject * _o, QMetaObject::Call _c, int _id, void * * _a) Line 92 C++
QtCored4.dll!QMetaCallEvent::placeMetaCall(QObject * object) Line 524 C++
QtCored4.dll!QObject::event(QEvent * e) Line 1194 C++
QtGuid4.dll!QWidget::event(QEvent * event) Line 8845 C++
QtGuid4.dll!QMainWindow::event(QEvent * event) Line 1479 C++
QtGuid4.dll!QApplicationPrivate::notify_helper(QObject * receiver, QEvent * e) Line 4562 C++
QtGuid4.dll!QApplication::notify(QObject * receiver, QEvent * e) Line 4527 C++
QtCored4.dll!QCoreApplication::notifyInternal(QObject * receiver, QEvent * event) Line 946 C++
QtCored4.dll!QCoreApplication::sendEvent(QObject * receiver, QEvent * event) Line 231 C++
QtCored4.dll!QCoreApplicationPrivate::sendPostedEvents(QObject * receiver, int event_type, QThreadData * data) Line 1570 C++
QtCored4.dll!qt_internal_proc(HWND__ * hwnd, unsigned int message, unsigned int wp, long lp) Line 496 C++
user32.dll!75ce62fa() Unknown
user32.dll!75ce6d3a() Unknown
user32.dll!75ce6ce9() Unknown
user32.dll!75ce77c4() Unknown
user32.dll!75ce788a() Unknown
QtCored4.dll!QEventDispatcherWin32::processEvents(QFlags<enum QEventLoop::ProcessEventsFlag> flags) Line 810 C++
QtGuid4.dll!QGuiEventDispatcherWin32::processEvents(QFlags<enum QEventLoop::ProcessEventsFlag> flags) Line 1204 C++
QtCored4.dll!QEventLoop::processEvents(QFlags<enum QEventLoop::ProcessEventsFlag> flags) Line 150 C++
QtCored4.dll!QEventLoop::exec(QFlags<enum QEventLoop::ProcessEventsFlag> flags) Line 204 C++
QtCored4.dll!QCoreApplication::exec() Line 1218 C++
QtGuid4.dll!QApplication::exec() Line 3824 C++
myapp.exe!main(int argc, char * * argv) Line 26 C++
myapp.exe!WinMain(HINSTANCE__ * instance, HINSTANCE__ * prevInstance, char * __formal, int cmdShow) Line 131 C++
myapp.exe!__tmainCRTStartup() Line 528 C
myapp.exe!WinMainCRTStartup() Line 377 C
kernel32.dll!758333aa() Unknown
ntdll.dll!77d59ef2() Unknown
ntdll.dll!77d59ec5() Unknown
I had the same problem with my own QT-Application using Qt 4.8.3 with OpenGL.
I found out that the crash is due to the using OpenGL paint engine. The engine type should automatically be set to OnegGL2 if the OpenGL driver reports that it supports OpenGL 2.0. This seems to be failing in my case.
To fix the problem I set the OpenGL preferred paint engine by adding the following code before constructing my QT-Application:
QGL::setPreferredPaintEngine(QPaintEngine::OpenGL);
Okay... here is your laundry list:
Make sure that you are building with the MSVS compiler, and compiling for win32.
If your application is surrounded by dll's built for mingw, or win64, you may have just entered "DLL he**". Make sure that you don't have any dll's sitting right next to your application's exe, or in the working directory (probably your folder that your source is in).
http://msdn.microsoft.com/en-us/library/windows/desktop/ms682586(v=vs.85).aspx#search_order_for_desktop_applications
Now go and check your system and user environment variables. Make sure that there isn't a listing for some Qt folder that you aren't building for.
Also go and make sure that Qt Creator or Visual Studio is pointing that the version of Qt you are building for.
Do a build clean on your project, and rebuild the whole thing. Be sure to read the "Compile Output" and "Build Output" folders.
Try building and running your program in debug. Then also try building and running your program in release. Make note of the application output, and the compile output.
If you are still crashing on startup, go and start putting in debug statements throughout your code to see where it is dying, or break points when you are running you debug version in debug mode. For example: qDebug() << Q_FUNC_INFO; at the top of your main function.
Also when it crashes, make note of the return code. Searching the return code in Google can also tell you a lot about what is going on.
Also check the paths that your program relies on.
Go and check your .pro file for any dependencies that you weren't aware of.
And beyond that you will probably need to give more info to get more help from me. :)
Hope that helps.