0

A windows application I am working on contains the following code:

if (_camStar->GetSortedContainersFromOpsView("CAD", false, containers, errorMessage)) {
    error = "";
    if (!containers.empty())
    {
        desc = QString::fromStdString(containers[0]->masterProductDescription);
        prodname = QString::fromStdString(containers[0]->productName).trimmed();
        res = QString::fromStdString(containers[0]->ctnrName);
    }
}
else
{
    error = QString::fromStdString(errorMessage);
}

_camStar is a variable from an external header file to which I am initializing here via:

_camStar = new CamstarInterface(host, port, username, password, workstation);

CamstarInterface is an interface that's declared in that same header file. When I run the program in Debug mode, I am presented with:

Unhandled Exception at 0xx5c84337d (msvcp100d.dll) in initializer.exe: 0xC0000005: Access violation reading location 0xffffffffffffffff.

and it breaks in xutility (I believe its used by Qt) in the function Orphan_all(). When I run the program in Release mode, everything works fine. How would I go about digging into the exception to see what exactly it doesn't like?

EDIT: The xutility file is shown when I have a try/catch surrounding the code above and is opened when I return the QString res variable. Otherwise I see the following unhandled exception on the GetSortedContainersFromOpsView line:

Unhandled Exception at 0x000007fefce7a06d in initializer.exe: 0xC0000005: Access violation writing location 0x00000000004ffff8.

No other file is opened. The stack trace looks like so:

initializer!initializer::GetNextImplant(QString& error) Line 347 + 0x5e bytes
initializer!initializer::Process() Line 298 + 0x17 bytes
initializer!initializer::Start() Line 169
initializer!main(int argc, char**argv) Line 18
initializer!WinMain() line 131 + 0x16 bytes
initializer!__tmainCRTStartup() line 547 + 0x42 bytes
initializer!WinMainCRTStartup() Line 371

At line 347 is the GetSortedContainersFromOpsView call. What should I do? It doesn't really seem to give me much.

dangerisgo
  • 1,261
  • 3
  • 16
  • 28
  • 4
    *and it breaks in xutility (I believe its used by Qt) in the function Orphan_all()* -- That function is part of the Visual Studio runtime library. When the exception occurs, what line of your code causes it? Look at the call stack. – PaulMcKenzie Dec 30 '19 at 18:59
  • [What is a debugger and how can it help me diagnose problems?](https://stackoverflow.com/q/25385173/5910058) – Jesper Juhl Dec 30 '19 at 19:12
  • @PaulMcKenzie I have updated my OP with an edit and a stack trace – dangerisgo Dec 30 '19 at 19:20
  • 1
    Please post a [mre], from the exception details looks like a null pointer de-reference – Alan Birtles Dec 30 '19 at 19:29
  • @AlanBirtles I would like to but I'm not sure how. There is a hierarchy of dependencies that the _camStar variable is derived from. To get to the actual implementation of `GetSortedContainersFromOpsView`, you have to go through about 3 wrappers before you get to the VB project which contains said code. How would I be able to reproduce that here? All the projects are C++ except for the final one in VB. – dangerisgo Dec 30 '19 at 19:38
  • Delete bits of your code (you of course have your code backed up somewhere...) until the crash stops happening, the crash is likely in the deleted bits, delete other bits until you are only left with the crashing code and you'll have a [mre] – Alan Birtles Dec 30 '19 at 19:46

1 Answers1

0

The issue was indeed related to one of the dependencies. One of the dependencies has invalid references due to a .NET 4.5/Visual Studio 2010 issue. Removing and re-adding all of those references in the dependency project, and rebuilding the library fixed the issue.

dangerisgo
  • 1,261
  • 3
  • 16
  • 28