<?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[pointer changing, without using anything in code]]></title><description><![CDATA[<pre><code>__name__
CThreadController::CThreadController  () 
main threcon = 0x557b040d76d0
CGUI::CGUI() 
CGUI::InitTestBoard 
InitTestBoard try begin 
InitTestBoard try 2 
InitTestBoard try end 
CGUI::InitDistance 
CGUI::InitCalibration 
CGUI::InitMotor 
main gui = 0x557b040bdac0
**main cont = 0x557b045ce800**
CThreadController gui = 0x557b040bdac0
**CThreadController cont = 0x557b045ce800**
CGUI::SetController controller = 0x557b040d76d0
CControls::SetController begin 
CThreadController::startThreads() begin
CThreadController::startThreads() end
Btn_motor_update_Clicked begin 
CGUI::Btn_motor_update_Clicked pin = 12
CControls::SetNumPinPerBoard this = 0x557b045ce800
CControls::SetNumPinPerBoard n = 12
CGUI::Btn_motor_update_Clicked step = 4
CControls::SetStepMtrPst n = 4
**CControls::SetStepMtrPst this = 0x557b045ce800**
CControls::SetStepMtrPst m_iStepMtrPst = 4
CGUI::Btn_motor_update_Clicked m_threadcontroller = 0x557b040d76d0
**CThreadController::SetNumMotorPos m_controls = 0x557b00000031**
CControls::SetNumMotorPos begin 
**CControls::SetNumMotorPos this = 0x557b00000031**
CControls::SetNumMotorPos m_iStepMtrPst = Press &lt;RETURN&gt; to close this window...
</code></pre>
<p dir="auto">m_threadcontroller  is correct in class CGUI, but m_controls is randomly changed CThreadController.<br />
sometimes m_controls changes to something that crashes program.<br />
m_controls is set in only one place, and no second call to CThreadController constructor is made.<br />
at first i thought</p>
<pre><code>connect(m_gui, &amp;CNC::CGUI::emitNumPinPerBoard, m_controls, &amp;CNC::CControls::SetNumPinPerBoard);
</code></pre>
<p dir="auto">and</p>
<pre><code>connect(m_gui, &amp;CNC::CGUI::emitStepMtrPst, m_controls, &amp;CNC::CControls::SetStepMtrPst);
</code></pre>
<p dir="auto">was not passing the values</p>
<p dir="auto">not finished making all the thread connections. want to know why and how the pointer is changing</p>
]]></description><link>https://forum.qt.io/topic/139265/pointer-changing-without-using-anything-in-code</link><generator>RSS for Node</generator><lastBuildDate>Thu, 05 Nov 2026 02:30:03 GMT</lastBuildDate><atom:link href="https://forum.qt.io/topic/139265.rss" rel="self" type="application/rss+xml"/><pubDate>Mon, 12 Sep 2022 21:35:51 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to pointer changing, without using anything in code on Wed, 21 Sep 2022 00:19:15 GMT]]></title><description><![CDATA[<p dir="auto">well, if i comment out</p>
<pre><code>m_controls-&gt;start();
</code></pre>
<p dir="auto">in</p>
<pre><code>// function
    void CThreadController::startThreads()
    {
        m_controls-&gt;start();
    }
</code></pre>
<p dir="auto">then the pointers do not change</p>
<pre><code>start();
</code></pre>
<p dir="auto">is not my code.</p>
]]></description><link>https://forum.qt.io/post/729525</link><guid isPermaLink="true">https://forum.qt.io/post/729525</guid><dc:creator><![CDATA[micha_eleric]]></dc:creator><pubDate>Wed, 21 Sep 2022 00:19:15 GMT</pubDate></item><item><title><![CDATA[Reply to pointer changing, without using anything in code on Sat, 17 Sep 2022 12:10:58 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/micha_eleric">@<bdi>micha_eleric</bdi></a> said in <a href="/post/728617">pointer changing, without using anything in code</a>:</p>
<blockquote>
<p dir="auto">i assume the minimum would be no code, since i can not find anything in my code to create the error.</p>
</blockquote>
<p dir="auto">Your assumption is very likely wrong.  The thing is, with errors like this, it is very commonly the case that code elsewhere in your application has a memory error, but that the effect of that error is not visible until later (eg an earlier memory error could have overwritten your code segement, so your code no longer matches what you're reading in your editor).  In other words, the <em>bug</em> might be nowhere near the <em>crash</em> (or pointer change) as far as lines of code goes.</p>
<p dir="auto">There's a couple of approaches I've found to work in cases like this:</p>
<ol>
<li>use a static analysis tool, like cppcheck (it's not going to pick up subtle things, but its so quick and easy to start with).</li>
<li>use a memory fencing tool, like valgrind</li>
<li>slowly remove as much code as possible, including (especially) code elsewhere that you assume couldn't possibly be related to this area of the code (I've been surprised plenty of times ;)</li>
</ol>
<p dir="auto">In particular, the exercise of cutting it down to "a minimal, compilable example", as <a class="plugin-mentions-user plugin-mentions-a" href="/user/christian-ehrlicher">@<bdi>Christian-Ehrlicher</bdi></a> suggested, will effectively force you to do #3 anyway, and often you'll discover the bug in that process, before you even get to posting the minimal example.  But if you do get it down to a minimal compilable example, do share it! :D</p>
<p dir="auto">Good luck!</p>
]]></description><link>https://forum.qt.io/post/729102</link><guid isPermaLink="true">https://forum.qt.io/post/729102</guid><dc:creator><![CDATA[Paul Colby]]></dc:creator><pubDate>Sat, 17 Sep 2022 12:10:58 GMT</pubDate></item><item><title><![CDATA[Reply to pointer changing, without using anything in code on Fri, 16 Sep 2022 01:08:25 GMT]]></title><description><![CDATA[<p dir="auto">i tried a copy constructor, but it was not called</p>
]]></description><link>https://forum.qt.io/post/728898</link><guid isPermaLink="true">https://forum.qt.io/post/728898</guid><dc:creator><![CDATA[micha_eleric]]></dc:creator><pubDate>Fri, 16 Sep 2022 01:08:25 GMT</pubDate></item><item><title><![CDATA[Reply to pointer changing, without using anything in code on Fri, 16 Sep 2022 00:19:39 GMT]]></title><description><![CDATA[<pre><code>__name__
CThreadController::CThreadController  () 
main threcon = 0x561d71086500
CGUI::CGUI 
CGUI::InitTestBoard 
InitTestBoard try begin 
InitTestBoard try 2 
InitTestBoard try end 
CGUI::InitDistance 
CGUI::InitCalibration 
CGUI::InitMotor 
main gui = 0x561d710809a0
CControls::Constructor 
main cont = 0x561d71590fd0
CThreadController gui = 0x561d710809a0
CThreadController cont = 0x561d71590fd0
CGUI::SetController controller = 0x561d71086500
CControls::SetController begin 
CThreadController::startThreads begin
CThreadController::startThreads m_controls = 0x561d71590fd0
CThreadController::startThreads m_gui = 0x561d710809a0
CThreadController::startThreads this = 0x561d71086500
CThreadController::startThreads m_controls = 0x561d71590fd0
CThreadController::startThreads m_gui = 0x561d710809a0
CThreadController::startThreads() end
CThreadController::ShowPointers m_controls = 0x561d71590fd0
CThreadController::ShowPointers m_gui = 0x561d710809a0
Btn_motor_update_Clicked begin 
CThreadController::ShowPointers m_controls = 0x561d00000021
CThreadController::ShowPointers m_gui = 0x561d7172ae70
CGUI::Btn_motor_update_Clicked pin = 12
CControls::SetNumPinPerBoard this = 0x561d71590fd0
CControls::SetNumPinPerBoard m_threadcontroller = 0x561d71086500
CControls::SetNumPinPerBoard n = 12
CThreadController::ShowPointers m_controls = 0x561d00000021
CThreadController::ShowPointers m_gui = 0x561d7172ae70
CGUI::Btn_motor_update_Clicked step = 4
CControls::SetStepMtrPst this = 0x561d71590fd0
CControls::SetStepMtrPst m_threadcontroller = 0x561d71086500
CControls::SetStepMtrPst n = 4
CControls::SetStepMtrPst m_iStepMtrPst = 4
CGUI::Btn_motor_update_Clicked m_threadcontroller = 0x561d71086500
CThreadController::SetNumMotorPos this = 0x561d71086500
CThreadController::SetNumMotorPos m_controls = 0x561d00000021
CThreadController::SetNumMotorPos m_gui = 0x561d7172ae70
CControls::SetNumMotorPos begin 
CControls::SetNumMotorPos this = 0x561d00000021
Press &lt;RETURN&gt; to close this window...
</code></pre>
<p dir="auto">from std::cout output, it is clear the my code in main calls</p>
<pre><code>threcon-&gt;startThreads();
</code></pre>
<p dir="auto">at the end of</p>
<pre><code>void CThreadController::startThreads()
</code></pre>
<p dir="auto">the only 3 pointers my code creates/calls constructors, are what they are suppose to be.<br />
next</p>
<pre><code>    threcon-&gt;ShowPointers();
    gui-&gt;show();
    return app.exec();
</code></pre>
<p dir="auto">then button is pushed, calling</p>
<pre><code>void CGUI::Btn_BoardUpdate_Clicked()
</code></pre>
<p dir="auto">which, without calling any constructors, there are 3 new pointers created out of thin air.<br />
what/where/why are the 3 new pointers coming from?<br />
only possible answers i come up with:<br />
does qt create, create pointers that do not call constructors?<br />
when</p>
<pre><code>connect(m_gui, &amp;CNC::CGUI::emitRun, m_controls, &amp;CNC::CControls::Run);
</code></pre>
<p dir="auto">does it create a duplicate pointers, which does not call constructors?</p>
<p dir="auto">dont know what else could be happening.<br />
if i reset the pointers in CThreadController, would whatever created new pointers, without calling a constructor, do it again. would i have to reset the pointers, every time a button is clicked?</p>
]]></description><link>https://forum.qt.io/post/728767</link><guid isPermaLink="true">https://forum.qt.io/post/728767</guid><dc:creator><![CDATA[micha_eleric]]></dc:creator><pubDate>Fri, 16 Sep 2022 00:19:39 GMT</pubDate></item><item><title><![CDATA[Reply to pointer changing, without using anything in code on Tue, 13 Sep 2022 22:57:44 GMT]]></title><description><![CDATA[<p dir="auto">change of pointers occur between</p>
<pre><code>void CThreadController::startThreads()
</code></pre>
<p dir="auto">and</p>
<pre><code>void CGUI::Btn_motor_update_Clicked()
</code></pre>
<p dir="auto">from what i can find</p>
]]></description><link>https://forum.qt.io/post/728621</link><guid isPermaLink="true">https://forum.qt.io/post/728621</guid><dc:creator><![CDATA[micha_eleric]]></dc:creator><pubDate>Tue, 13 Sep 2022 22:57:44 GMT</pubDate></item><item><title><![CDATA[Reply to pointer changing, without using anything in code on Tue, 13 Sep 2022 22:34:42 GMT]]></title><description><![CDATA[<p dir="auto">finally got a try to not crash</p>
<pre><code>main threcon = 0x55b88df8dd00
CGUI::CGUI() 
CGUI::InitTestBoard 
InitTestBoard try begin 
InitTestBoard try 2 
InitTestBoard try end 
CGUI::InitDistance 
CGUI::InitCalibration 
CGUI::InitMotor 
main gui = 0x55b88df72d40
main cont = 0x55b88e483610
CThreadController gui = 0x55b88df72d40
CThreadController cont = 0x55b88e483610
CGUI::SetController controller = 0x55b88df8dd00
CControls::SetController begin 
CThreadController::startThreads begin
CThreadController::startThreads m_controls = 0x55b88e483610
CThreadController::startThreads m_gui = 0x55b88df72d40
CThreadController::startThreads this = 0x55b88df8dd00
CThreadController::startThreads m_controls = 0x55b88e483610
CThreadController::startThreads m_gui = 0x55b88df72d40
CThreadController::startThreads() end
CThreadController::ShowPointers m_controls = 0x55b88e483610
CThreadController::ShowPointers m_gui = 0x55b88df72d40
Btn_motor_update_Clicked begin 
CGUI::Btn_motor_update_Clicked pin = 12
CControls::SetNumPinPerBoard this = 0x55b88e483610
CControls::SetNumPinPerBoard m_threadcontroller = 0x55b88df8dd00
CControls::SetNumPinPerBoard n = 12
CGUI::Btn_motor_update_Clicked step = 4
CControls::SetStepMtrPst this = 0x55b88e483610
CControls::SetStepMtrPst m_threadcontroller = 0x55b88df8dd00
CControls::SetStepMtrPst n = 4
CControls::SetStepMtrPst m_iStepMtrPst = 4
CGUI::Btn_motor_update_Clicked m_threadcontroller = 0x55b88df8dd00
CThreadController::SetNumMotorPos this = 0x55b88df8dd00
CThreadController::SetNumMotorPos m_controls = 0x55b88e6bd590
CThreadController::SetNumMotorPos m_gui = 0x55b8800000ef
CControls::SetNumMotorPos begin 
CControls::SetNumMotorPos this = 0x55b88e6bd590
CControls::SetNumMotorPos m_threadcontroller = 0x7fe7fc8aa668
CControls::SetNumMotorPos m_iStepMtrPst = -11711155
CMotor::SetNumMotorPos begin 
num = -11711155
error: CMotor.SetNumMotorPos() 
Btn_motor_update_Clicked end 
Press &lt;RETURN&gt; to close this window...
</code></pre>
<p dir="auto">correct CThreadController points to wrong CControls points back to wrong CThreadControlls</p>
]]></description><link>https://forum.qt.io/post/728619</link><guid isPermaLink="true">https://forum.qt.io/post/728619</guid><dc:creator><![CDATA[micha_eleric]]></dc:creator><pubDate>Tue, 13 Sep 2022 22:34:42 GMT</pubDate></item><item><title><![CDATA[Reply to pointer changing, without using anything in code on Tue, 13 Sep 2022 22:30:50 GMT]]></title><description><![CDATA[<p dir="auto">added</p>
<pre><code>std::cout &lt;&lt; "CControls::SetNumMotorPos m_threadcontroller = " &lt;&lt; m_threadcontroller &lt;&lt; '\n' &lt;&lt; std::flush;
</code></pre>
<p dir="auto">causes it to crash with multiple tries.<br />
what i thought was a different  m_threadcontroller in CControls, but was also a different CControls object, which i still question where the second CControls and CGUI object came from, when no new objects are created</p>
]]></description><link>https://forum.qt.io/post/728618</link><guid isPermaLink="true">https://forum.qt.io/post/728618</guid><dc:creator><![CDATA[micha_eleric]]></dc:creator><pubDate>Tue, 13 Sep 2022 22:30:50 GMT</pubDate></item><item><title><![CDATA[Reply to pointer changing, without using anything in code on Tue, 13 Sep 2022 21:59:45 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/728614">pointer changing, without using anything in code</a>:</p>
<blockquote>
<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/micha_eleric">@<bdi>micha_eleric</bdi></a> said in <a href="/post/728613">pointer changing, without using anything in code</a>:</p>
<blockquote>
<p dir="auto">where and why is class data m_controls and m_gui changing in class CThreadController?</p>
</blockquote>
<p dir="auto">Provide a minimal, compilable example instead posting the whole question over and over without any real information.</p>
</blockquote>
<p dir="auto">i assume the minimum would be no code, since i can not find anything in my code to create the error. i posted everything of my code, where the error showed up. i keep adding more std::cout, trying to figure out between my code and my code it is happening.</p>
]]></description><link>https://forum.qt.io/post/728617</link><guid isPermaLink="true">https://forum.qt.io/post/728617</guid><dc:creator><![CDATA[micha_eleric]]></dc:creator><pubDate>Tue, 13 Sep 2022 21:59:45 GMT</pubDate></item><item><title><![CDATA[Reply to pointer changing, without using anything in code on Tue, 13 Sep 2022 20:19:01 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/micha_eleric">@<bdi>micha_eleric</bdi></a> said in <a href="/post/728613">pointer changing, without using anything in code</a>:</p>
<blockquote>
<p dir="auto">where and why is class data m_controls and m_gui changing in class CThreadController?</p>
</blockquote>
<p dir="auto">Provide a minimal, compilable example instead posting the whole question over and over without any real information.</p>
]]></description><link>https://forum.qt.io/post/728614</link><guid isPermaLink="true">https://forum.qt.io/post/728614</guid><dc:creator><![CDATA[Christian Ehrlicher]]></dc:creator><pubDate>Tue, 13 Sep 2022 20:19:01 GMT</pubDate></item><item><title><![CDATA[Reply to pointer changing, without using anything in code on Tue, 13 Sep 2022 20:16:27 GMT]]></title><description><![CDATA[<pre><code>__name__
CThreadController::CThreadController  () 
main threcon = 0x564ac2f50fe0
CGUI::CGUI() 
CGUI::InitTestBoard 
InitTestBoard try begin 
InitTestBoard try 2 
InitTestBoard try end 
CGUI::InitDistance 
CGUI::InitCalibration 
CGUI::InitMotor 
main gui = 0x564ac2f677c0
main cont = 0x564ac3478010
CThreadController gui = 0x564ac2f677c0
CThreadController cont = 0x564ac3478010
CGUI::SetController controller = 0x564ac2f50fe0
CControls::SetController begin 
CThreadController::startThreads begin
CThreadController::startThreads m_controls = 0x564ac3478010
CThreadController::startThreads m_gui = 0x564ac2f677c0
CThreadController::startThreads this = 0x564ac2f50fe0
CThreadController::startThreads m_controls = 0x564ac3478010
CThreadController::startThreads m_gui = 0x564ac2f677c0
CThreadController::startThreads() end
CThreadController::ShowPointers m_controls = 0x564ac3478010
CThreadController::ShowPointers m_gui = 0x564ac2f677c0
Btn_motor_update_Clicked begin 
CGUI::Btn_motor_update_Clicked pin = 12
CControls::SetNumPinPerBoard this = 0x564ac3478010
CControls::SetNumPinPerBoard n = 12
CGUI::Btn_motor_update_Clicked step = 4
CControls::SetStepMtrPst n = 4
CControls::SetStepMtrPst this = 0x564ac3478010
CControls::SetStepMtrPst m_iStepMtrPst = 4
CGUI::Btn_motor_update_Clicked m_threadcontroller = 0x564ac2f50fe0
CThreadController::SetNumMotorPos m_controls = 0x564ac3492190
CThreadController::SetNumMotorPos m_gui = 0x564a800000ee
CControls::SetNumMotorPos begin 
CControls::SetNumMotorPos this = 0x564ac3492190
CControls::SetNumMotorPos m_threadcontroller = 0x7f74f0b38980
CControls::SetNumMotorPos m_iStepMtrPst = 0
CMotor::SetNumMotorPos begin 
num = 0
error: CMotor.SetNumMotorPos() 
Btn_motor_update_Clicked end 
Press &lt;RETURN&gt; to close this window...

</code></pre>
<p dir="auto">where and why is class data m_controls and m_gui changing in class CThreadController?</p>
<p dir="auto">class data m_threadcontroller is not changing in class CGUI, but is changing in class CControls?</p>
]]></description><link>https://forum.qt.io/post/728613</link><guid isPermaLink="true">https://forum.qt.io/post/728613</guid><dc:creator><![CDATA[micha_eleric]]></dc:creator><pubDate>Tue, 13 Sep 2022 20:16:27 GMT</pubDate></item><item><title><![CDATA[Reply to pointer changing, without using anything in code on Tue, 13 Sep 2022 02:03:54 GMT]]></title><description><![CDATA[<pre><code>int main(int argc, char **argv)
{
    std::cout &lt;&lt; "__name__\n" &lt;&lt; std::flush;
    QApplication app (argc, argv);
    CNC::CThreadController *threcon = new CNC::CThreadController();
    std::cout &lt;&lt; "main threcon = " &lt;&lt; threcon &lt;&lt; '\n' &lt;&lt; std::flush;
    CNC::CGUI *gui = new CNC::CGUI();
    std::cout &lt;&lt; "main gui = " &lt;&lt; gui &lt;&lt; '\n' &lt;&lt; std::flush;
    CNC::CControls *cont = new CNC::CControls();
    std::cout &lt;&lt; "main cont = " &lt;&lt; cont &lt;&lt; '\n' &lt;&lt; std::flush;
    threcon-&gt;SetGUI(gui);
    threcon-&gt;SetControls(cont);
    gui-&gt;SetController(threcon);
    cont-&gt;SetController(threcon);
    threcon-&gt;startThreads();
    gui-&gt;show();
    return app.exec();
    //return 1;
}

</code></pre>
<pre><code>void CThreadController::SetControls(CControls *cont)
    {
        std::cout &lt;&lt; "CThreadController cont = " &lt;&lt; cont &lt;&lt; '\n' &lt;&lt; std::flush;
        m_controls = cont;
    }

    void CThreadController::SetGUI(CGUI *gui)
    {
        std::cout &lt;&lt; "CThreadController gui = " &lt;&lt; gui &lt;&lt; '\n' &lt;&lt; std::flush;
        m_gui = gui;
    }
</code></pre>
<pre><code>void CGUI::SetController(CThreadController *controller)
    {
        std::cout &lt;&lt; "CGUI::SetController controller = " &lt;&lt; controller &lt;&lt; '\n' &lt;&lt; std::flush;
        m_threadcontroller = controller;
    }
</code></pre>
<pre><code>void CControls::SetController(CThreadController *controller)
    {
        std::cout &lt;&lt; "CControls::SetController begin \n" &lt;&lt; std::flush;
        m_threadcontroller = controller;
    }
</code></pre>
<pre><code>void CThreadController::startThreads()
    {
        std::cout &lt;&lt; "CThreadController::startThreads() begin\n" &lt;&lt; std::flush;

        //?? does (this) have to be sent to CNC::CControls(this);?
        //CNC::CControls *controlsThread = new CNC::CControls(this);
        //?? connect(m_controls, signal, this, slots);
        connect(m_controls, &amp;CNC::CControls::finished, this, &amp;QObject::deleteLater);

        connect(m_controls, &amp;CNC::CControls::emitMessageBoxRed, m_gui, &amp;CNC::CGUI::RecieveMessageBoxRed);


        //?? gui
        connect(m_gui, &amp;CNC::CGUI::emitBitDia, m_controls, &amp;CNC::CControls::SetBitDia);

        connect(m_gui, &amp;CNC::CGUI::emitMove_To, m_controls, &amp;CNC::CControls::Move_To);

        connect(m_gui, &amp;CNC::CGUI::emitMove_A_axis, m_controls, &amp;CNC::CControls::Move_A_axis);
        connect(m_gui, &amp;CNC::CGUI::emitMove_B_axis, m_controls, &amp;CNC::CControls::Move_B_axis);
        connect(m_gui, &amp;CNC::CGUI::emitMove_C_axis, m_controls, &amp;CNC::CControls::Move_C_axis);
        connect(m_gui, &amp;CNC::CGUI::emitMove_X_axis, m_controls, &amp;CNC::CControls::Move_X_axis);
        connect(m_gui, &amp;CNC::CGUI::emitMove_Y_axis, m_controls, &amp;CNC::CControls::Move_Y_axis);
        connect(m_gui, &amp;CNC::CGUI::emitMove_Z_axis, m_controls, &amp;CNC::CControls::Move_Z_axis);

        connect(m_gui, &amp;CNC::CGUI::emitMin_A, m_controls, &amp;CNC::CControls::SetMin_A);
        connect(m_gui, &amp;CNC::CGUI::emitMin_B, m_controls, &amp;CNC::CControls::SetMin_B);
        connect(m_gui, &amp;CNC::CGUI::emitMin_C, m_controls, &amp;CNC::CControls::SetMin_C);
        connect(m_gui, &amp;CNC::CGUI::emitMin_X, m_controls, &amp;CNC::CControls::SetMin_X);
        connect(m_gui, &amp;CNC::CGUI::emitMin_Y, m_controls, &amp;CNC::CControls::SetMin_Y);
        connect(m_gui, &amp;CNC::CGUI::emitMin_Z, m_controls, &amp;CNC::CControls::SetMin_Z);

        connect(m_gui, &amp;CNC::CGUI::emitMax_A, m_controls, &amp;CNC::CControls::SetMax_A);
        connect(m_gui, &amp;CNC::CGUI::emitMax_B, m_controls, &amp;CNC::CControls::SetMax_B);
        connect(m_gui, &amp;CNC::CGUI::emitMax_C, m_controls, &amp;CNC::CControls::SetMax_C);
        connect(m_gui, &amp;CNC::CGUI::emitMax_X, m_controls, &amp;CNC::CControls::SetMax_X);
        connect(m_gui, &amp;CNC::CGUI::emitMax_Y, m_controls, &amp;CNC::CControls::SetMax_Y);
        connect(m_gui, &amp;CNC::CGUI::emitMax_Z, m_controls, &amp;CNC::CControls::SetMax_Z);

        connect(m_gui, &amp;CNC::CGUI::emitNumPinPerBoard, m_controls, &amp;CNC::CControls::SetNumPinPerBoard);
        connect(m_gui, &amp;CNC::CGUI::emitRun, m_controls, &amp;CNC::CControls::Run);


        connect(m_gui, &amp;CNC::CGUI::emitPortName_1, m_controls, &amp;CNC::CControls::SetPortName_1);
        connect(m_gui, &amp;CNC::CGUI::emitPortName_1, m_controls, &amp;CNC::CControls::SetPortName_2);
        connect(m_gui, &amp;CNC::CGUI::emitPortName_1, m_controls, &amp;CNC::CControls::SetPortName_3);
        connect(m_gui, &amp;CNC::CGUI::emitPortName_1, m_controls, &amp;CNC::CControls::SetPortName_4);

        connect(m_gui, &amp;CNC::CGUI::emitSer_1_connected, m_controls, &amp;CNC::CControls::SetSer_1_connected);
        connect(m_gui, &amp;CNC::CGUI::emitSer_2_connected, m_controls, &amp;CNC::CControls::SetSer_2_connected);
        connect(m_gui, &amp;CNC::CGUI::emitSer_3_connected, m_controls, &amp;CNC::CControls::SetSer_3_connected);
        connect(m_gui, &amp;CNC::CGUI::emitSer_4_connected, m_controls, &amp;CNC::CControls::SetSer_4_connected);

        connect(m_gui, &amp;CNC::CGUI::emitState, m_controls, &amp;CNC::CControls::SetState);
        connect(m_gui, &amp;CNC::CGUI::emitStepMtrPst, m_controls, &amp;CNC::CControls::SetStepMtrPst);

        m_controls-&gt;start();

        std::cout &lt;&lt; "CThreadController::startThreads() end\n" &lt;&lt; std::flush;
    }
</code></pre>
<pre><code>void CGUI::Btn_motor_update_Clicked()
    {
        std::cout &lt;&lt; "Btn_motor_update_Clicked begin \n" &lt;&lt; std::flush;
        try
        {
            //?? number pin per board ?? var name?
            int temp = (ui-&gt;textEdit_21-&gt;toPlainText()).toInt();
            std::cout &lt;&lt; "CGUI::Btn_motor_update_Clicked pin = " &lt;&lt; temp &lt;&lt; '\n' &lt;&lt; std::flush;
            emit emitNumPinPerBoard(temp);

            temp = (ui-&gt;textEdit_20-&gt;toPlainText()).toInt();
            std::cout &lt;&lt; "CGUI::Btn_motor_update_Clicked step = " &lt;&lt; temp &lt;&lt; '\n' &lt;&lt; std::flush;
            emit emitStepMtrPst(temp);

            std::cout &lt;&lt; "CGUI::Btn_motor_update_Clicked m_threadcontroller = " &lt;&lt; m_threadcontroller &lt;&lt; '\n' &lt;&lt; std::flush;
            m_threadcontroller-&gt;SetNumMotorPos();

            std::cout &lt;&lt; "Btn_motor_update_Clicked 4 \n" &lt;&lt; std::flush;
            MessageBoxYellow("Number position on motors, &amp; Number of pins per board, updated");
            std::cout &lt;&lt; "Btn_motor_update_Clicked 5 \n" &lt;&lt; std::flush;
        }
        catch(std::exception&amp; e)
        {
            MessageBoxError(e.what());
        }
        std::cout &lt;&lt; "Btn_motor_update_Clicked end \n" &lt;&lt; std::flush;
    }
</code></pre>
<pre><code>void CControls::SetNumPinPerBoard(int n)
    {
        //std::cout &lt;&lt; "CControls::SetNumPinPerBoard begin \n" &lt;&lt; std::flush;
        std::cout &lt;&lt; "CControls::SetNumPinPerBoard this = " &lt;&lt; this &lt;&lt;  '\n' &lt;&lt; std::flush;
        std::cout &lt;&lt; "CControls::SetNumPinPerBoard n = " &lt;&lt; n &lt;&lt; '\n' &lt;&lt; std::flush;

        m_iNumPinPerBoard = n;
    }
</code></pre>
<pre><code>void CControls::SetStepMtrPst(int n)
    {
        //std::cout &lt;&lt; "CControls::SetStepMtrPst \n" &lt;&lt; std::flush;
        std::cout &lt;&lt; "CControls::SetStepMtrPst n = " &lt;&lt; n &lt;&lt;  '\n' &lt;&lt; std::flush;
        std::cout &lt;&lt; "CControls::SetStepMtrPst this = " &lt;&lt; this &lt;&lt;  '\n' &lt;&lt; std::flush;

        m_iStepMtrPst = n;
        std::cout &lt;&lt; "CControls::SetStepMtrPst m_iStepMtrPst = " &lt;&lt; m_iStepMtrPst &lt;&lt;  '\n' &lt;&lt; std::flush;

    }
</code></pre>
<pre><code>void CThreadController::SetNumMotorPos()
    {
        std::cout &lt;&lt; "CThreadController::SetNumMotorPos m_controls = " &lt;&lt; m_controls &lt;&lt; '\n' &lt;&lt; std::flush;
        m_controls-&gt;SetNumMotorPos();
    }
</code></pre>
<pre><code>void CControls::SetNumMotorPos()
    {
        std::cout &lt;&lt; "CControls::SetNumMotorPos begin \n" &lt;&lt; std::flush;
        std::cout &lt;&lt; "CControls::SetNumMotorPos this = " &lt;&lt; this &lt;&lt;  '\n' &lt;&lt; std::flush;
        std::cout &lt;&lt; "CControls::SetNumMotorPos m_iStepMtrPst = " &lt;&lt; std::flush;
        std::cout &lt;&lt; m_iStepMtrPst &lt;&lt; '\n' &lt;&lt; std::flush;

        m_motor_A_axis.SetNumMotorPos(m_iStepMtrPst);
        m_motor_B_axis.SetNumMotorPos(m_iStepMtrPst);
        m_motor_C_axis.SetNumMotorPos(m_iStepMtrPst);

        m_motor_X_axis.SetNumMotorPos(m_iStepMtrPst);
        m_motor_Y_axis.SetNumMotorPos(m_iStepMtrPst);
        m_motor_Z_axis.SetNumMotorPos(m_iStepMtrPst);

        std::cout &lt;&lt; "CControls::SetNumMotorPos end \n" &lt;&lt; std::flush;
    }
</code></pre>
<p dir="auto">since the address to CControls object is set in main, and nothing in my code creates a new CThreadController object, why is CControls object changing?</p>
]]></description><link>https://forum.qt.io/post/728455</link><guid isPermaLink="true">https://forum.qt.io/post/728455</guid><dc:creator><![CDATA[micha_eleric]]></dc:creator><pubDate>Tue, 13 Sep 2022 02:03:54 GMT</pubDate></item><item><title><![CDATA[Reply to pointer changing, without using anything in code on Tue, 13 Sep 2022 01:40:05 GMT]]></title><description><![CDATA[<p dir="auto">my code is not changing the value of the pointer. the pointer is randomly changing from outside of my code</p>
]]></description><link>https://forum.qt.io/post/728454</link><guid isPermaLink="true">https://forum.qt.io/post/728454</guid><dc:creator><![CDATA[micha_eleric]]></dc:creator><pubDate>Tue, 13 Sep 2022 01:40:05 GMT</pubDate></item><item><title><![CDATA[Reply to pointer changing, without using anything in code on Tue, 13 Sep 2022 01:17:49 GMT]]></title><description><![CDATA[<p dir="auto">I think people are going to need more than your two connect statements to tell you what's wrong with your code.</p>
]]></description><link>https://forum.qt.io/post/728453</link><guid isPermaLink="true">https://forum.qt.io/post/728453</guid><dc:creator><![CDATA[mchinand]]></dc:creator><pubDate>Tue, 13 Sep 2022 01:17:49 GMT</pubDate></item></channel></rss>