<?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[Problem in QVariantList in Qt 5.12?]]></title><description><![CDATA[<p dir="auto">The following code snippet used to work fine on Qt 5.4, but on 5.12 it triggers a breakpoint inside QVariant's destructor.</p>
<pre><code>int main(int argc, char *argv[])
{
	QApplication a(argc, argv);

	if (true)
	{
		QVariant res;

		QVariantList list;
		list.append(QVariant(true));
		res = list;
	}
	qDebug() &lt;&lt; "App started";

	int result = a.exec();
	return result;
}

</code></pre>
<p dir="auto">If you change the code in order to use a QVariantMap instead of a QVariantList, it does work. Anybody can tell me why?</p>
<pre><code>int main(int argc, char *argv[])
{
	QApplication a(argc, argv);

	if (true)
	{
		QVariant res;

		QVariantMap map;
		map.insert("1", QVariant(true));
		res = map;

	}
	qDebug() &lt;&lt; "App started";

	int result = a.exec();
	return result;
}

</code></pre>
<p dir="auto">Compiled for x86 using Qt 5.12 with VS2017 on Win 10.</p>
]]></description><link>https://forum.qt.io/topic/132407/problem-in-qvariantlist-in-qt-5-12</link><generator>RSS for Node</generator><lastBuildDate>Mon, 19 Oct 2026 04:28:24 GMT</lastBuildDate><atom:link href="https://forum.qt.io/topic/132407.rss" rel="self" type="application/rss+xml"/><pubDate>Tue, 30 Nov 2021 12:31:55 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Problem in QVariantList in Qt 5.12? on Wed, 01 Dec 2021 11:13:46 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/christian-ehrlicher">@<bdi>Christian-Ehrlicher</bdi></a> My mistake: I could not use the right runtime library switch because I had "Ignore specific default libraries" set! Now I recompiled in debug with /MT and it works! Thanks a lot.</p>
]]></description><link>https://forum.qt.io/post/692660</link><guid isPermaLink="true">https://forum.qt.io/post/692660</guid><dc:creator><![CDATA[Maxxximo]]></dc:creator><pubDate>Wed, 01 Dec 2021 11:13:46 GMT</pubDate></item><item><title><![CDATA[Reply to Problem in QVariantList in Qt 5.12? on Wed, 01 Dec 2021 05:34:30 GMT]]></title><description><![CDATA[<p dir="auto">As I said above - you <strong>must not</strong> mix debug and release libraries. It may work but may break suddenly due to the different msvc rntimes used. And this may also be the problem here.</p>
<p dir="auto">/edit: you can compile your app in debug mode and use release-only libraries but only when you use the same MSVC runtime -&gt; <code>/MD</code> instead <code>/MDd</code></p>
]]></description><link>https://forum.qt.io/post/692574</link><guid isPermaLink="true">https://forum.qt.io/post/692574</guid><dc:creator><![CDATA[Christian Ehrlicher]]></dc:creator><pubDate>Wed, 01 Dec 2021 05:34:30 GMT</pubDate></item><item><title><![CDATA[Reply to Problem in QVariantList in Qt 5.12? on Tue, 30 Nov 2021 20:39:51 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/maxxximo">@<bdi>Maxxximo</bdi></a><br />
I agree we do not know whether this is related to your issue.</p>
<p dir="auto">But this is not a question of <code>.lib</code> files.  At <em>runtime</em> you are not supposed to have some parts of your code --- DLLs or not --- compiled for debug mixed with some for release, because they call for two incompatible versions of the MS runtime (<code>MSVCRT</code>/<code>MSVCRTD.DLL</code>).  If you are able to compile/link <em>only</em> one or the other and see if this affects your problem it would be a good idea.</p>
]]></description><link>https://forum.qt.io/post/692546</link><guid isPermaLink="true">https://forum.qt.io/post/692546</guid><dc:creator><![CDATA[JonB]]></dc:creator><pubDate>Tue, 30 Nov 2021 20:39:51 GMT</pubDate></item><item><title><![CDATA[Reply to Problem in QVariantList in Qt 5.12? on Tue, 30 Nov 2021 20:31:49 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/christian-ehrlicher">@<bdi>Christian-Ehrlicher</bdi></a> Ok, just to make it clear: Qt is built as a dynamic library, i.e. Qt5Core.lib is the import library for Qt5Core.dll. This way I definitely can build my app in debug mode and use Qt5Core.dll compiled in release.<br />
I can set breakpoints and step into my code and watch variables, actually I've been doing this for about 7 years on this same application.<br />
I still don't get why it does work with QVariantMap, and doesn't with QVariantList....there must be some other reason, imho.</p>
]]></description><link>https://forum.qt.io/post/692545</link><guid isPermaLink="true">https://forum.qt.io/post/692545</guid><dc:creator><![CDATA[Maxxximo]]></dc:creator><pubDate>Tue, 30 Nov 2021 20:31:49 GMT</pubDate></item><item><title><![CDATA[Reply to Problem in QVariantList in Qt 5.12? on Tue, 30 Nov 2021 19:53:10 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/maxxximo">@<bdi>Maxxximo</bdi></a> said in <a href="/post/692530">Problem in QVariantList in Qt 5.12?</a>:</p>
<blockquote>
<p dir="auto">why shouldn't it be possible?</p>
</blockquote>
<p dir="auto">Because you must not mix debug and release libraries on windows since debug libs are using msvcrt<strong>d</strong>.dll and release ones msvcrt.dll which are not compatible.</p>
]]></description><link>https://forum.qt.io/post/692536</link><guid isPermaLink="true">https://forum.qt.io/post/692536</guid><dc:creator><![CDATA[Christian Ehrlicher]]></dc:creator><pubDate>Tue, 30 Nov 2021 19:53:10 GMT</pubDate></item><item><title><![CDATA[Reply to Problem in QVariantList in Qt 5.12? on Tue, 30 Nov 2021 19:45:18 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/maxxximo">@<bdi>Maxxximo</bdi></a> This would work fine if you always write bug-free code and use bug-free libraries.</p>
]]></description><link>https://forum.qt.io/post/692531</link><guid isPermaLink="true">https://forum.qt.io/post/692531</guid><dc:creator><![CDATA[mchinand]]></dc:creator><pubDate>Tue, 30 Nov 2021 19:45:18 GMT</pubDate></item><item><title><![CDATA[Reply to Problem in QVariantList in Qt 5.12? on Tue, 30 Nov 2021 19:42:48 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/692513">Problem in QVariantList in Qt 5.12?</a>:</p>
<blockquote>
<p dir="auto">You can't even create your own app as debug version without the Qt debug libs.</p>
</blockquote>
<p dir="auto">This sounds strange to me, why shouldn't it be possible? It's rather common using release libraries and the only constraint is not being able to debug them!</p>
]]></description><link>https://forum.qt.io/post/692530</link><guid isPermaLink="true">https://forum.qt.io/post/692530</guid><dc:creator><![CDATA[Maxxximo]]></dc:creator><pubDate>Tue, 30 Nov 2021 19:42:48 GMT</pubDate></item><item><title><![CDATA[Reply to Problem in QVariantList in Qt 5.12? on Tue, 30 Nov 2021 18:31:24 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/maxxximo">@<bdi>Maxxximo</bdi></a> said in <a href="/post/692512">Problem in QVariantList in Qt 5.12?</a>:</p>
<blockquote>
<p dir="auto">I am using a Qt version that has been supplied together with a commercial system, therefore I only have the release version of Qt.</p>
</blockquote>
<p dir="auto">Then ask for the debug libraries then - otherwise a useful development is imo not really possible. You can't even create your own app as debug version without the Qt debug libs.</p>
]]></description><link>https://forum.qt.io/post/692513</link><guid isPermaLink="true">https://forum.qt.io/post/692513</guid><dc:creator><![CDATA[Christian Ehrlicher]]></dc:creator><pubDate>Tue, 30 Nov 2021 18:31:24 GMT</pubDate></item><item><title><![CDATA[Reply to Problem in QVariantList in Qt 5.12? on Tue, 30 Nov 2021 18:28:19 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/christian-ehrlicher">@<bdi>Christian-Ehrlicher</bdi></a> I am using a Qt version that has been supplied together with a commercial system, therefore I only have the release version of Qt.<br />
I checked the dependencies, and my app depends only on Qt5Core.dll, which in turn depends on msvcp140.dll and vcruntime140.dll, so it shouldn't be a problem.</p>
]]></description><link>https://forum.qt.io/post/692512</link><guid isPermaLink="true">https://forum.qt.io/post/692512</guid><dc:creator><![CDATA[Maxxximo]]></dc:creator><pubDate>Tue, 30 Nov 2021 18:28:19 GMT</pubDate></item><item><title><![CDATA[Reply to Problem in QVariantList in Qt 5.12? on Tue, 30 Nov 2021 16:52:30 GMT]]></title><description><![CDATA[<p dir="auto">Are you sure you don't mix binaries compiled with different MSVC versions? See e.g. here: <a href="https://bugreports.qt.io/browse/QTBUG-30009" target="_blank" rel="noopener noreferrer nofollow ugc">https://bugreports.qt.io/browse/QTBUG-30009</a></p>
<p dir="auto">Also compile your code in debug mode (and against Qt debug libs) to see where exactly inside Qt it is crashing.</p>
]]></description><link>https://forum.qt.io/post/692496</link><guid isPermaLink="true">https://forum.qt.io/post/692496</guid><dc:creator><![CDATA[Christian Ehrlicher]]></dc:creator><pubDate>Tue, 30 Nov 2021 16:52:30 GMT</pubDate></item><item><title><![CDATA[Reply to Problem in QVariantList in Qt 5.12? on Tue, 30 Nov 2021 16:00:15 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/mchinand">@<bdi>mchinand</bdi></a> Here:<br />
<img src="https://ddgobkiprc33d.cloudfront.net/28fbf0ee-7ac4-4e2b-a6c9-f5fa67cd50b1.png" alt="Breakpoint.png" class=" img-fluid img-markdown" /></p>
]]></description><link>https://forum.qt.io/post/692487</link><guid isPermaLink="true">https://forum.qt.io/post/692487</guid><dc:creator><![CDATA[Maxxximo]]></dc:creator><pubDate>Tue, 30 Nov 2021 16:00:15 GMT</pubDate></item><item><title><![CDATA[Reply to Problem in QVariantList in Qt 5.12? on Tue, 30 Nov 2021 15:49:02 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/maxxximo">@<bdi>Maxxximo</bdi></a> Looking at the stack trace, which line of code of yours does it break on?</p>
]]></description><link>https://forum.qt.io/post/692484</link><guid isPermaLink="true">https://forum.qt.io/post/692484</guid><dc:creator><![CDATA[mchinand]]></dc:creator><pubDate>Tue, 30 Nov 2021 15:49:02 GMT</pubDate></item><item><title><![CDATA[Reply to Problem in QVariantList in Qt 5.12? on Tue, 30 Nov 2021 15:46:15 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/mchinand">@<bdi>mchinand</bdi></a> With my configuration the code faults in both Release and Debug mode. I noticed the problem because I had to upgrade to Qt 5.12 from 5.4</p>
]]></description><link>https://forum.qt.io/post/692483</link><guid isPermaLink="true">https://forum.qt.io/post/692483</guid><dc:creator><![CDATA[Maxxximo]]></dc:creator><pubDate>Tue, 30 Nov 2021 15:46:15 GMT</pubDate></item><item><title><![CDATA[Reply to Problem in QVariantList in Qt 5.12? on Tue, 30 Nov 2021 15:10:48 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/mchinand">@<bdi>mchinand</bdi></a> If I remove the if block it gets properly executed both in debug and release. At any rate it works in 6.2.1.</p>
]]></description><link>https://forum.qt.io/post/692475</link><guid isPermaLink="true">https://forum.qt.io/post/692475</guid><dc:creator><![CDATA[artwaw]]></dc:creator><pubDate>Tue, 30 Nov 2021 15:10:48 GMT</pubDate></item><item><title><![CDATA[Reply to Problem in QVariantList in Qt 5.12? on Tue, 30 Nov 2021 14:40:25 GMT]]></title><description><![CDATA[<p dir="auto">Is this perhaps a too simplified example of your actual code? It seems that your <code>if(true)</code> block will probably be removed (optimized out) entirely when compiled in Release mode.</p>
]]></description><link>https://forum.qt.io/post/692472</link><guid isPermaLink="true">https://forum.qt.io/post/692472</guid><dc:creator><![CDATA[mchinand]]></dc:creator><pubDate>Tue, 30 Nov 2021 14:40:25 GMT</pubDate></item><item><title><![CDATA[Reply to Problem in QVariantList in Qt 5.12? on Tue, 30 Nov 2021 14:37:29 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/maxxximo">@<bdi>Maxxximo</bdi></a> Simple console app on macOS (Qt 6.2.1) proves it works with QVariantList:</p>
<pre><code>#include &lt;QCoreApplication&gt;

int main(int argc, char *argv[])
{
    QCoreApplication a(argc, argv);
    if (true)
    {
        QVariant res;

        QVariantList list;
        list.append(QVariant(true));
        res = list;
    }
    qDebug() &lt;&lt; "App started";

    return a.exec();
}
</code></pre>
<p dir="auto"><img src="https://ddgobkiprc33d.cloudfront.net/f8c00ab9-927e-444f-a3c9-d41c70344858.png" alt="3a81e78f-c420-4fd8-9089-6c89295e120a-image.png" class=" img-fluid img-markdown" /></p>
]]></description><link>https://forum.qt.io/post/692471</link><guid isPermaLink="true">https://forum.qt.io/post/692471</guid><dc:creator><![CDATA[artwaw]]></dc:creator><pubDate>Tue, 30 Nov 2021 14:37:29 GMT</pubDate></item><item><title><![CDATA[Reply to Problem in QVariantList in Qt 5.12? on Tue, 30 Nov 2021 14:32:35 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/jonb">@<bdi>JonB</bdi></a>  Yeah you're right :)</p>
<p dir="auto">but no problem with QVariantList either.</p>
]]></description><link>https://forum.qt.io/post/692469</link><guid isPermaLink="true">https://forum.qt.io/post/692469</guid><dc:creator><![CDATA[mpergand]]></dc:creator><pubDate>Tue, 30 Nov 2021 14:32:35 GMT</pubDate></item><item><title><![CDATA[Reply to Problem in QVariantList in Qt 5.12? on Tue, 30 Nov 2021 14:25:59 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/mpergand">@<bdi>mpergand</bdi></a><br />
You mis-read :)  OP is saying <code>QVariantMap</code> <em>does</em> work for him, but <code>QVariantList</code> instead does not....</p>
]]></description><link>https://forum.qt.io/post/692467</link><guid isPermaLink="true">https://forum.qt.io/post/692467</guid><dc:creator><![CDATA[JonB]]></dc:creator><pubDate>Tue, 30 Nov 2021 14:25:59 GMT</pubDate></item><item><title><![CDATA[Reply to Problem in QVariantList in Qt 5.12? on Tue, 30 Nov 2021 14:22:45 GMT]]></title><description><![CDATA[<p dir="auto">No problem here on MacOS and Qt 5.12.10</p>
<pre><code>{
QVariant res;

QVariantMap map;
map.insert("1", QVariant(true));
map.insert("2", QVariant(true));
res = map;
qDebug()&lt;&lt;res.value&lt;QVariantMap&gt;();
}
</code></pre>
<p dir="auto">output log: QMap(("1", QVariant(bool, true))("2", QVariant(bool, true)))</p>
]]></description><link>https://forum.qt.io/post/692466</link><guid isPermaLink="true">https://forum.qt.io/post/692466</guid><dc:creator><![CDATA[mpergand]]></dc:creator><pubDate>Tue, 30 Nov 2021 14:22:45 GMT</pubDate></item></channel></rss>