<?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[HELP) Initialization issue with QList&lt;QList&lt;QLineSeries*&gt;&gt; m_seriess_2d]]></title><description><![CDATA[<p dir="auto">Hello</p>
<p dir="auto">I'm using Qt Chart to float multiple pieces of data on a single chart</p>
<p dir="auto">Press the current button to reset the chart and update the data again</p>
<p dir="auto">The program will continue to be terminated in the process of clearing m_serious_2d, a two-dimensional array</p>
<p dir="auto">I tried gpt and several documents, but I couldn't solve them<br />
If you know the answer, please let me know</p>
<pre><code>private:
	Ui::performance_page m_ui;

	QList&lt;QChart*&gt; m_chart;
	QList&lt;QChartView*&gt; m_chartview;
	QList&lt;QList&lt;QLineSeries*&gt;&gt; m_seriess_2d;
	QList&lt;QDateTimeAxis*&gt; m_axis_x_list;
	QList&lt;QValueAxis*&gt; m_axis_y_list;
</code></pre>
<pre><code>void performance_page::clear()
{
	cout &lt;&lt; "performance_page::clear" &lt;&lt; endl;

	m_selected = -1;
	
	for (int i = 0; i &lt; m_chartview.size(); i++)
	{
		if (m_chartview[i])
		{
			m_chartview[i]-&gt;deleteLater();
			m_chartview[i] = nullptr;
		}
		if (m_chart[i])
		{
			delete m_chart[i];
			m_chart[i] = nullptr;
			m_axis_x_list[i] = nullptr;
			m_axis_y_list[i] = nullptr;
		}

	}
	
	m_chartview.clear();
	m_chart.clear();
	m_axis_x_list.clear();
	m_axis_y_list.clear();
	
	for (int i = 0; i &lt; m_seriess_2d.size(); i++)
	{
		for (int j = 0; j &lt; m_seriess_2d[i].size(); j++)
		{
			if (nullptr != m_seriess_2d[i][j])
			{
				m_seriess_2d[i][j] = nullptr;
			}
		}
		m_seriess_2d[i].clear();
	}
	//m_seriess_2d.clear(); - Program boom!!
</code></pre>
]]></description><link>https://forum.qt.io/topic/163176/help-initialization-issue-with-qlist-qlist-qlineseries-m_seriess_2d</link><generator>RSS for Node</generator><lastBuildDate>Sat, 26 Sep 2026 23:33:22 GMT</lastBuildDate><atom:link href="https://forum.qt.io/topic/163176.rss" rel="self" type="application/rss+xml"/><pubDate>Mon, 08 Sep 2025 08:33:04 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to HELP) Initialization issue with QList&lt;QList&lt;QLineSeries*&gt;&gt; m_seriess_2d on Tue, 09 Sep 2025 15:44:49 GMT]]></title><description><![CDATA[<p dir="auto">It's for sure a double free - please provide a minimal, compilable example to reproduce the issue</p>
]]></description><link>https://forum.qt.io/post/831379</link><guid isPermaLink="true">https://forum.qt.io/post/831379</guid><dc:creator><![CDATA[Christian Ehrlicher]]></dc:creator><pubDate>Tue, 09 Sep 2025 15:44:49 GMT</pubDate></item><item><title><![CDATA[Reply to HELP) Initialization issue with QList&lt;QList&lt;QLineSeries*&gt;&gt; m_seriess_2d on Tue, 09 Sep 2025 07:40:13 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/jsulm">@<bdi>jsulm</bdi></a></p>
<p dir="auto"><a href="https://forum.qt.io/topic/145364/forum-guidelines-code-of-conduct">https://forum.qt.io/topic/145364/forum-guidelines-code-of-conduct</a></p>
<p dir="auto">Aha, I understand..</p>
<p dir="auto">Sorry I'm not good at it, so I don't think I can split it to the point where it can be compiled..</p>
<p dir="auto"><img src="https://ddgobkiprc33d.cloudfront.net/9a1d294a-6c18-47d7-b733-43048868541e.png" alt="7b24576f-887a-43c1-bb38-7badda2decbd-image.png" class=" img-fluid img-markdown" /></p>
<p dir="auto"><img src="https://ddgobkiprc33d.cloudfront.net/b28e00a7-1f49-4110-9338-909027690e60.png" alt="3bcf2130-0592-497e-b110-56a373a966df-image.png" class=" img-fluid img-markdown" /></p>
]]></description><link>https://forum.qt.io/post/831351</link><guid isPermaLink="true">https://forum.qt.io/post/831351</guid><dc:creator><![CDATA[Joonsoo]]></dc:creator><pubDate>Tue, 09 Sep 2025 07:40:13 GMT</pubDate></item><item><title><![CDATA[Reply to HELP) Initialization issue with QList&lt;QList&lt;QLineSeries*&gt;&gt; m_seriess_2d on Tue, 09 Sep 2025 07:20:12 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/joonsoo">@<bdi>Joonsoo</bdi></a> <a class="plugin-mentions-user plugin-mentions-a" href="/user/christian-ehrlicher">@<bdi>Christian-Ehrlicher</bdi></a> asked you to provide a minimal <em>compilable</em> example, not a piece of code.<br />
m_serious_2d contains lists of pointers, so it does not own QLineSeries.<br />
It could help if you would provide the stack trace after the crash...</p>
]]></description><link>https://forum.qt.io/post/831346</link><guid isPermaLink="true">https://forum.qt.io/post/831346</guid><dc:creator><![CDATA[jsulm]]></dc:creator><pubDate>Tue, 09 Sep 2025 07:20:12 GMT</pubDate></item><item><title><![CDATA[Reply to HELP) Initialization issue with QList&lt;QList&lt;QLineSeries*&gt;&gt; m_seriess_2d on Tue, 09 Sep 2025 07:17:40 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/jsulm">@<bdi>jsulm</bdi></a></p>
<p dir="auto">Well, I don't know how to minimize it<br />
If you look at the current code</p>
<p dir="auto">After the creation of m_serious_2d is completed, initialize it<br />
There's an error</p>
<p dir="auto">Are you saying that there should be no problem with this part?</p>
<p dir="auto">Doesn't m_serious_2d own ownership?</p>
<p dir="auto">Does Chart have ownership in Chartview?</p>
]]></description><link>https://forum.qt.io/post/831345</link><guid isPermaLink="true">https://forum.qt.io/post/831345</guid><dc:creator><![CDATA[Joonsoo]]></dc:creator><pubDate>Tue, 09 Sep 2025 07:17:40 GMT</pubDate></item><item><title><![CDATA[Reply to HELP) Initialization issue with QList&lt;QList&lt;QLineSeries*&gt;&gt; m_seriess_2d on Tue, 09 Sep 2025 07:00:46 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/joonsoo">@<bdi>Joonsoo</bdi></a> This is not a minimal compilable example. And you also did not provide stack trace after the crash.</p>
]]></description><link>https://forum.qt.io/post/831344</link><guid isPermaLink="true">https://forum.qt.io/post/831344</guid><dc:creator><![CDATA[jsulm]]></dc:creator><pubDate>Tue, 09 Sep 2025 07:00:46 GMT</pubDate></item><item><title><![CDATA[Reply to HELP) Initialization issue with QList&lt;QList&lt;QLineSeries*&gt;&gt; m_seriess_2d on Tue, 09 Sep 2025 06:42:17 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/christian-ehrlicher">@<bdi>Christian-Ehrlicher</bdi></a> ```</p>
<pre><code>for (int i = 0; i &lt; m_list.size(); i++)
{
	int m_seriess_size =  m_seriess_2d.size();

	if (i &lt; m_seriess_size)
	{
	}
	else
	{
		m_seriess_2d.push_back(QList&lt;QLineSeries*&gt;());
	}

	m_seriess_2d[i].resize(4);

	for (int j = 0; j &lt; 4; j++)
	{
		QLineSeries* series = new QLineSeries();
		series-&gt;setName(QString::fromLocal8Bit(m_list[i]-&gt;getProcName().c_str()));
		m_chart[j]-&gt;addSeries(series);
		m_seriess_2d[i][j] = series;
	}
}

for (int i = 0; i &lt; m_list.size(); i++)
{
	for (int j = 0; j &lt; 4; j++)
	{
		m_seriess_2d[i][j] = nullptr;
	}
	m_seriess_2d[i].clear();
}
m_seriess_2d.clear();
</code></pre>
<p dir="auto">Even if you try to initialize it after creating it, m_serious_2d.clear(); an error occurs in this part as shown in the picture above</p>
<p dir="auto">In this situation, m_serious_2d is not even added to the chart</p>
<p dir="auto">What's the problem?</p>
]]></description><link>https://forum.qt.io/post/831343</link><guid isPermaLink="true">https://forum.qt.io/post/831343</guid><dc:creator><![CDATA[Joonsoo]]></dc:creator><pubDate>Tue, 09 Sep 2025 06:42:17 GMT</pubDate></item><item><title><![CDATA[Reply to HELP) Initialization issue with QList&lt;QList&lt;QLineSeries*&gt;&gt; m_seriess_2d on Tue, 09 Sep 2025 04:12:58 GMT]]></title><description><![CDATA[<p dir="auto">Please provide a minimal, compilable example to reproduce the crash. Minimize your code until it no longer crashes.</p>
]]></description><link>https://forum.qt.io/post/831335</link><guid isPermaLink="true">https://forum.qt.io/post/831335</guid><dc:creator><![CDATA[Christian Ehrlicher]]></dc:creator><pubDate>Tue, 09 Sep 2025 04:12:58 GMT</pubDate></item><item><title><![CDATA[Reply to HELP) Initialization issue with QList&lt;QList&lt;QLineSeries*&gt;&gt; m_seriess_2d on Tue, 09 Sep 2025 00:24:42 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/jonb">@<bdi>JonB</bdi></a></p>
<p dir="auto">Well, I've tried several initialization methods that other GPTs tell me, but I kept getting errors while trying to make m_serious_2d size zero</p>
<p dir="auto">m_seriess_2d.resize(0);<br />
m_seriess_2d.clear();</p>
<p dir="auto">If you do this, you'll get an error<br />
I don't know why</p>
<p dir="auto">I've tried to operate it without using it anywhere else, but I can't solve it!</p>
<p dir="auto">What am I missing?</p>
<p dir="auto"><img src="https://ddgobkiprc33d.cloudfront.net/c8219b6b-3515-4327-adb5-fcee4fd681af.png" alt="2.png" class=" img-fluid img-markdown" /></p>
<p dir="auto"><img src="https://ddgobkiprc33d.cloudfront.net/5aa1f2e9-09b2-4d3a-bd17-18198cb67158.png" alt="1.png" class=" img-fluid img-markdown" /></p>
]]></description><link>https://forum.qt.io/post/831332</link><guid isPermaLink="true">https://forum.qt.io/post/831332</guid><dc:creator><![CDATA[Joonsoo]]></dc:creator><pubDate>Tue, 09 Sep 2025 00:24:42 GMT</pubDate></item><item><title><![CDATA[Reply to HELP) Initialization issue with QList&lt;QList&lt;QLineSeries*&gt;&gt; m_seriess_2d on Mon, 08 Sep 2025 09:02:04 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/joonsoo">@<bdi>Joonsoo</bdi></a> said in <a href="/post/831291">HELP) Initialization issue with QList&lt;QList&lt;QLineSeries*&gt;&gt; m_seriess_2d</a>:</p>
<blockquote>
<p dir="auto">//m_seriess_2d.clear(); - Program boom!!</p>
</blockquote>
<p dir="auto">"Program boom!!" is not a proper description/diagnosis of an issue.  Run it inside a debugger and look at the <em>stack trace</em> if it "crashes" for a clue as to where/why.</p>
<p dir="auto">The error <em>might</em> not directly be caused by clearing a series.  It might show up there as a result of something else.  You might e.g. try commenting out the series deletion to see whether it still happens.  One thought I have is that you have done <code>delete m_chart[i]</code> on a <code>QChart</code> which is presumably the chart in use by <code>m_chartview[i]</code>.  Is that safe, the <code>QChartView</code> now references a <code>QChart</code> which has been deleted?  Remember that the <code>QChartView</code> takes ownership of the <code>QChart</code>.  Similarly I am not sure you need to clear your multiple <code>QLineSeries</code>, when they were added to the <code>QChart</code> it took ownership of them.</p>
]]></description><link>https://forum.qt.io/post/831292</link><guid isPermaLink="true">https://forum.qt.io/post/831292</guid><dc:creator><![CDATA[JonB]]></dc:creator><pubDate>Mon, 08 Sep 2025 09:02:04 GMT</pubDate></item></channel></rss>