<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[&quot;Read access violation&quot; exception]]></title><description><![CDATA[<p dir="auto">Hello all,</p>
<p dir="auto">I am currently breaking my head on a crash (we are using Qt 5.14.0 and Visual Studio 2015).  When running one of our Google Test unit tests, the test only <em>sometimes</em> fails (in my case, in 1 out of 4 runs) with an error dialog having the text:</p>
<pre><code>Exception thrown: read access violation.
temp-&gt; was 0x4C311B4
If there is a handler for this exception, the program may be safely continued.
</code></pre>
<p dir="auto">The call stack at the time of the crash looks as follows (note that I renamed some things in order not to reveal company code):</p>
<pre><code>Qt5Networkd.dll!Microsoft::WRL::ComPtr&lt;IConnectionPoint&gt;::InternalRelease() Line 200
Qt5Networkd.dll!Microsoft::WRL::ComPtr&lt;IConnectionPoint&gt;::~ComPtr&lt;IConnectionPoint&gt;() Line 256
Qt5Networkd.dll!QNetworkListManagerEvents::~QNetworkListManagerEvents() Line 560
[External Code]	
Qt5Networkd.dll!QNetworkListManagerEvents::Release() Line 482
Qt5Networkd.dll!Microsoft::WRL::ComPtr&lt;QNetworkListManagerEvents&gt;::InternalRelease() Line 200
Qt5Networkd.dll!Microsoft::WRL::ComPtr&lt;QNetworkListManagerEvents&gt;::Reset() Line 401
Qt5Networkd.dll!QNetworkStatusMonitorPrivate::~QNetworkStatusMonitorPrivate() Line 632
[External Code]	
Qt5Cored.dll!QScopedPointerDeleter&lt;QObjectData&gt;::cleanup(QObjectData * pointer=0x05342b40) Line 60
Qt5Cored.dll!QScopedPointer&lt;QObjectData,QScopedPointerDeleter&lt;QObjectData&gt; &gt;::~QScopedPointer&lt;QObjectData,QScopedPointerDeleter&lt;QObjectData&gt; &gt;() Line 107
Qt5Cored.dll!QObject::~QObject() Line 1119
Qt5Networkd.dll!QNetworkStatusMonitor::~QNetworkStatusMonitor() Line 667
Qt5Networkd.dll!QNetworkAccessManagerPrivate::~QNetworkAccessManagerPrivate() Line 1927
[External Code]	
Qt5Cored.dll!QScopedPointerDeleter&lt;QObjectData&gt;::cleanup(QObjectData * pointer=0x05340958) Line 60
Qt5Cored.dll!QScopedPointer&lt;QObjectData,QScopedPointerDeleter&lt;QObjectData&gt; &gt;::~QScopedPointer&lt;QObjectData,QScopedPointerDeleter&lt;QObjectData&gt; &gt;() Line 107
Qt5Cored.dll!QObject::~QObject() Line 1119
Qt5Networkd.dll!QNetworkAccessManager::~QNetworkAccessManager() Line 535
[External Code]	
Qt5Cored.dll!QObjectPrivate::deleteChildren() Line 2123
Qt5Cored.dll!QObject::~QObject() Line 1110
[External Code]	
Qt5XmlPatternsd.dll!QPatternist::ReferenceCountedValue&lt;QObject&gt;::~ReferenceCountedValue&lt;QObject&gt;() Line 87
[External Code]	
Qt5XmlPatternsd.dll!QExplicitlySharedDataPointer&lt;QPatternist::ReferenceCountedValue&lt;QObject&gt; &gt;::~QExplicitlySharedDataPointer&lt;QPatternist::ReferenceCountedValue&lt;QObject&gt; &gt;() Line 184
[External Code]	
Qt5XmlPatternsd.dll!QXmlQuery::~QXmlQuery() Line 309
FooBarPlugins_gtest.exe!MyXPathParser::~MyXPathParser() Line 52
[External Code]	
FooBarPlugins_gtest.exe!ConfigResultGenerator::~ConfigResultGenerator() Line 77
[External Code]	
FooBarPlugins_gtest.exe!MyMockServer::~MyMockServer() Line 61
[External Code]	
FooBarPlugins_gtest.exe!MySuperTestWithSimulators::~MySuperTestWithSimulators() Line 142
[External Code]	
FooBarPlugins_gtest.exe!testing::Test::DeleteSelf_() Line 492
FooBarPlugins_gtest.exe!testing::internal::HandleSehExceptionsInMethodIfSupported&lt;testing::Test,void&gt;(testing::Test * object=0x01219360, void(testing::Test::*)() method=0x009087d3, const char * location=0x00d9bf98) Line 2418
FooBarPlugins_gtest.exe!testing::internal::HandleExceptionsInMethodIfSupported&lt;testing::Test,void&gt;(testing::Test * object=0x01219360, void(testing::Test::*)() method=0x009087d3, const char * location=0x00d9bf98) Line 2469
FooBarPlugins_gtest.exe!testing::TestInfo::Run() Line 2690
FooBarPlugins_gtest.exe!testing::TestSuite::Run() Line 2817
FooBarPlugins_gtest.exe!testing::internal::UnitTestImpl::RunAllTests() Line 5339
FooBarPlugins_gtest.exe!testing::internal::HandleSehExceptionsInMethodIfSupported&lt;testing::internal::UnitTestImpl,bool&gt;(testing::internal::UnitTestImpl * object=0x01182490, bool(testing::internal::UnitTestImpl::*)() method=0x00901e01, const char * location=0x00d9e558) Line 2418
FooBarPlugins_gtest.exe!testing::internal::HandleExceptionsInMethodIfSupported&lt;testing::internal::UnitTestImpl,bool&gt;(testing::internal::UnitTestImpl * object=0x01182490, bool(testing::internal::UnitTestImpl::*)() method=0x00901e01, const char * location=0x00d9e558) Line 2469
FooBarPlugins_gtest.exe!testing::UnitTest::Run() Line 4925
FooBarPlugins_gtest.exe!RUN_ALL_TESTS() Line 2474
FooBarPlugins_gtest.exe!main(int argc=3, char * * argv=0x01181cc8) Line 205
[External Code]	
</code></pre>
<p dir="auto">The crash  seems to occur at the end of the unit test, when the test fixture's destructor gets called.  Simplifying things, I think I have the following chain of destructors (from our own code):</p>
<pre><code>~MySuperTestWithSimulators()
=&gt; calls ~MyMockServer()
  =&gt; calls ~ConfigResultGenerator()
    =&gt; calls ~MyXPathParser()
      =&gt; calls ~QXmlQuery()
</code></pre>
<p dir="auto">Going even more up the call stack, I no longer encounter code written by us, the rest is third-party.</p>
<p dir="auto">Given the fact that the crash only occurs 1 out of 4 times, I think I should be looking for a race-condition.  However, I can't seem to find anything suspicious...   So given the above error message and call stack, here are my questions:</p>
<ol>
<li>Does anybody see the problem or can tell me what to look for?</li>
<li>What would you do in order to debug this further and better diagnose the problem?</li>
</ol>
<p dir="auto">Thanks!</p>
]]></description><link>https://forum.qt.io/topic/110872/read-access-violation-exception</link><generator>RSS for Node</generator><lastBuildDate>Fri, 16 Oct 2026 04:42:25 GMT</lastBuildDate><atom:link href="https://forum.qt.io/topic/110872.rss" rel="self" type="application/rss+xml"/><pubDate>Tue, 21 Jan 2020 14:55:05 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to &quot;Read access violation&quot; exception on Tue, 21 Jan 2020 23:30:54 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/christian-ehrlicher">@<bdi>Christian-Ehrlicher</bdi></a> said in <a href="/post/573437">"Read access violation" exception</a>:</p>
<blockquote>
<p dir="auto">Do you create a QNetworkAccessManager ?</p>
</blockquote>
<p dir="auto">For as far as I know and can see, 'no'.  However, I see that <code>QXmlQuery</code> has a <code>setNetworkAccessManager</code> and a <code>networkAccessManager</code> method... and apparently we are calling <code>QXmlQuery</code>'s destructor (see call stack)...</p>
<p dir="auto">Why were you asking this?</p>
]]></description><link>https://forum.qt.io/post/573494</link><guid isPermaLink="true">https://forum.qt.io/post/573494</guid><dc:creator><![CDATA[Bart_Vandewoestyne]]></dc:creator><pubDate>Tue, 21 Jan 2020 23:30:54 GMT</pubDate></item><item><title><![CDATA[Reply to &quot;Read access violation&quot; exception on Tue, 21 Jan 2020 16:28:34 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/bart_vandewoestyne">@<bdi>Bart_Vandewoestyne</bdi></a> said in <a href="/post/573423">"Read access violation" exception</a>:</p>
<blockquote>
<p dir="auto">QNetworkAccessManager</p>
</blockquote>
<p dir="auto">Do you create a QNetworkAccessManager ?</p>
]]></description><link>https://forum.qt.io/post/573437</link><guid isPermaLink="true">https://forum.qt.io/post/573437</guid><dc:creator><![CDATA[Christian Ehrlicher]]></dc:creator><pubDate>Tue, 21 Jan 2020 16:28:34 GMT</pubDate></item><item><title><![CDATA[Reply to &quot;Read access violation&quot; exception on Tue, 21 Jan 2020 16:07:54 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/bart_vandewoestyne">@<bdi>Bart_Vandewoestyne</bdi></a> said in <a href="/post/573423">"Read access violation" exception</a>:</p>
<blockquote>
<p dir="auto">Does anybody see the problem or can tell me what to look for?</p>
</blockquote>
<p dir="auto">Look for redundant deletions. If you try to access or delete an invalid pointer this crash can occur.<br />
Follow <code>temp</code> and check if memory address changes (where it is called.. destructor etc).</p>
<p dir="auto">Does it crash, if you comment some lines in your destructors? Have you figured out in which line exactly the crash occures?</p>
]]></description><link>https://forum.qt.io/post/573435</link><guid isPermaLink="true">https://forum.qt.io/post/573435</guid><dc:creator><![CDATA[Pl45m4]]></dc:creator><pubDate>Tue, 21 Jan 2020 16:07:54 GMT</pubDate></item></channel></rss>