<?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[The program has unexpectedly finished]]></title><description><![CDATA[<p dir="auto">Hi,</p>
<p dir="auto">I am working on a timer widget program, and have received this error:</p>
<p dir="auto"><em>The program has unexpectedly finished</em></p>
<p dir="auto">And the application's GUIs do not load, and the application builds fine. This is my code:</p>
<p dir="auto"><em>stopwatch_definitions.h:</em><br />
@<br />
#ifndef STOPWATCH_DEFINITIONS_H<br />
#define STOPWATCH_DEFINITIONS_H</p>
<p dir="auto">#include &lt;QObject&gt;<br />
#include &lt;QTimer&gt;</p>
<p dir="auto">class Stopwatch : public QObject<br />
{<br />
Q_OBJECT<br />
public:<br />
Stopwatch();<br />
private slots:<br />
void timer_Start();<br />
void timer_Pause();<br />
void timer_Reset();</p>
<pre><code>void timer_changeTime();
</code></pre>
<p dir="auto">private:<br />
QTimer* stopwatchTimer;<br />
};</p>
<p dir="auto">#endif // STOPWATCH_DEFINITIONS_H<br />
@</p>
<p dir="auto"><em>stopwatch.cpp:</em><br />
@<br />
#include "stopwatch_definitions.h"<br />
#include "ui_clock_application.h"</p>
<p dir="auto">Ui::Clock_Application* ui;</p>
<p dir="auto">Stopwatch::Stopwatch()<br />
{<br />
stopwatchTimer = 0;<br />
}</p>
<p dir="auto">void Stopwatch::timer_Reset()<br />
{<br />
timer_Pause();<br />
ui-&gt;Stopwatch_Output-&gt;setText("00:00:00");<br />
}</p>
<p dir="auto">void Stopwatch::timer_Pause()<br />
{<br />
stopwatchTimer-&gt;stop();<br />
}</p>
<p dir="auto">void Stopwatch::timer_Start()<br />
{<br />
if (!stopwatchTimer)<br />
{<br />
stopwatchTimer = new QTimer();<br />
connect(stopwatchTimer, SIGNAL(timeout()), this, SLOT(timer_changeTime()));<br />
stopwatchTimer-&gt;start(1000);<br />
}<br />
}</p>
<p dir="auto">void Stopwatch::timer_changeTime()<br />
{<br />
/* timer change code */<br />
}<br />
@</p>
<p dir="auto"><em>widget.cpp:</em><br />
@</p>
<p dir="auto">#include "widget_definitions.h"<br />
#include "ui_clock_application.h"<br />
#include "stopwatch_definitions.h"</p>
<p dir="auto">Clock_Application::Clock_Application(QWidget *parent) :<br />
QMainWindow(parent),<br />
ui(new Ui::Clock_Application)<br />
{<br />
ui-&gt;setupUi(this);</p>
<pre><code>Stopwatch* connectorClass;
connect(ui-&gt;Stopwatch_Start, SIGNAL(clicked()), connectorClass, SLOT(timer_Start()));
connect(ui-&gt;Stopwatch_Pause, SIGNAL(clicked()), connectorClass, SLOT(timer_Pause()));
connect(ui-&gt;Stopwatch_Reset, SIGNAL(clicked()), connectorClass, SLOT(timer_Reset()));
</code></pre>
<p dir="auto">}</p>
<p dir="auto">Clock_Application::~Clock_Application()<br />
{<br />
delete ui;<br />
}<br />
@</p>
]]></description><link>https://forum.qt.io/topic/16236/the-program-has-unexpectedly-finished</link><generator>RSS for Node</generator><lastBuildDate>Wed, 08 Apr 2026 15:15:27 GMT</lastBuildDate><atom:link href="https://forum.qt.io/topic/16236.rss" rel="self" type="application/rss+xml"/><pubDate>Thu, 26 Apr 2012 21:05:51 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to The program has unexpectedly finished on Mon, 05 Aug 2013 17:57:31 GMT]]></title><description><![CDATA[<p dir="auto">I remember that the timer must be stopped before closing the window, i had that problem before, and i resolved it by calling the 'stop' method when the program is closing.</p>
]]></description><link>https://forum.qt.io/post/151302</link><guid isPermaLink="true">https://forum.qt.io/post/151302</guid><dc:creator><![CDATA[juliocnl_92]]></dc:creator><pubDate>Mon, 05 Aug 2013 17:57:31 GMT</pubDate></item><item><title><![CDATA[Reply to The program has unexpectedly finished on Fri, 27 Apr 2012 00:19:17 GMT]]></title><description><![CDATA[<p dir="auto">I agree.</p>
<p dir="auto">If possible, the Stopwatch class shouldn't need to know about the whole <em>Ui::Clock_Application</em> class. I'd prefer to only pass a pointer to a QLabel object (or whatever type the <em>Stopwatch_Output</em> is) around, which makes the Stopwatch class more general, more reusable and less likely to be effected by changes in "far away" code...</p>
<p dir="auto">(But I wouldn't say that wrapping the "Stopwatch" functionality into its own class is bad per se. An alternative worth considering would be making the Stopwatch class <em>inherit</em> from QLabel or another Widget class though)</p>
<p dir="auto">@class Stopwatch : public QObject<br />
{<br />
Q_OBJECT</p>
<p dir="auto">public:<br />
Stopwatch(QLabel *output);</p>
<pre><code>...
</code></pre>
<p dir="auto">private:<br />
QTimer* stopwatchTimer;<br />
QLabel *m_output; //here we'll store the pointer to the Widget<br />
};</p>
<p dir="auto">...</p>
<p dir="auto">Stopwatch::Stopwatch(QLabel *output)<br />
{<br />
m_output = output; //Now store the pointer to the Widget<br />
stopwatchTimer = 0;<br />
}</p>
<p dir="auto">...</p>
<p dir="auto">void Stopwatch::timer_Reset()<br />
{<br />
timer_Pause();<br />
output-&gt;setText("00:00:00");<br />
}@</p>
<p dir="auto">@        Clock_Application::Clock_Application(QWidget *parent) :<br />
QMainWindow(parent),<br />
ui(new Ui::Clock_Application)<br />
{<br />
ui-&gt;setupUi(this);</p>
<pre><code>        myStopwatch = new Stopwatch(ui-&gt;Stopwatch_Output); // &lt;--- pass Widget
 
        ....@
</code></pre>
]]></description><link>https://forum.qt.io/post/137166</link><guid isPermaLink="true">https://forum.qt.io/post/137166</guid><dc:creator><![CDATA[MuldeR]]></dc:creator><pubDate>Fri, 27 Apr 2012 00:19:17 GMT</pubDate></item><item><title><![CDATA[Reply to The program has unexpectedly finished on Thu, 26 Apr 2012 23:53:31 GMT]]></title><description><![CDATA[<p dir="auto">[quote author="MuldeR" date="1335483291"]<br />
The name of your pointer variables doesn't matter. It matters that you store the right pointer![/quote]</p>
<p dir="auto">In fact, we can use the same name even without <em>this</em></p>
<p dir="auto">@<br />
Stopwatch::Stopwatch(Ui::Clock_Application *ui)<br />
:ui(ui)<br />
{<br />
//this-&gt;ui = ui;<br />
@</p>
<p dir="auto">But as I said in previous post, current design is rather bad. it will made the application more complex and difficult to maintain.</p>
<p dir="auto">[quote author="Flurite" date="1335480406"]<br />
I am going to have more slots in my application, and I just do not want to clutter up the Clock_Application class.. I think by dividing it into multiple files will make it simpler.<br />
[/quote]</p>
]]></description><link>https://forum.qt.io/post/137164</link><guid isPermaLink="true">https://forum.qt.io/post/137164</guid><dc:creator><![CDATA[dbzhang800]]></dc:creator><pubDate>Thu, 26 Apr 2012 23:53:31 GMT</pubDate></item><item><title><![CDATA[Reply to The program has unexpectedly finished on Thu, 26 Apr 2012 23:43:45 GMT]]></title><description><![CDATA[<p dir="auto">Yes, yes, I understand that. In fact, I thought of that right after I replied to your post. I don't know why, but I just have this need for a unique consistency in all my codes.</p>
]]></description><link>https://forum.qt.io/post/137161</link><guid isPermaLink="true">https://forum.qt.io/post/137161</guid><dc:creator><![CDATA[Flurite]]></dc:creator><pubDate>Thu, 26 Apr 2012 23:43:45 GMT</pubDate></item><item><title><![CDATA[Reply to The program has unexpectedly finished on Thu, 26 Apr 2012 23:34:51 GMT]]></title><description><![CDATA[<p dir="auto">Actually you could just have used other names:</p>
<p dir="auto">@class Stopwatch : public QObject<br />
{<br />
Q_OBJECT</p>
<p dir="auto">public:<br />
Stopwatch(Ui::Clock_Application *bar);</p>
<pre><code>...
</code></pre>
<p dir="auto">private:<br />
QTimer* stopwatchTimer;<br />
Ui::Clock_Application *m_foo; //here we'll store the actual ui-Pointer<br />
};</p>
<p dir="auto">.......</p>
<p dir="auto">Stopwatch::Stopwatch(Ui::Clock_Application *bar)<br />
{<br />
m_foo = bar; //Now store the ui-Pointer we got from the Clock_Application!<br />
stopwatchTimer = 0;<br />
}</p>
<p dir="auto">.......</p>
<p dir="auto">void Stopwatch::timer_Reset()<br />
{<br />
timer_Pause();<br />
m_foo-&gt;Stopwatch_Output-&gt;setText("00:00:00");<br />
}@</p>
<p dir="auto">@    Clock_Application::Clock_Application(QWidget *parent) :<br />
QMainWindow(parent),<br />
ui(new Ui::Clock_Application)<br />
{<br />
ui-&gt;setupUi(this);</p>
<pre><code>    myStopwatch = new Stopwatch(ui); // &lt;--- pass ui-Pointer over

    ....@
</code></pre>
<p dir="auto">The name of your pointer variables doesn't matter. It matters that you store the right pointer!</p>
]]></description><link>https://forum.qt.io/post/137160</link><guid isPermaLink="true">https://forum.qt.io/post/137160</guid><dc:creator><![CDATA[MuldeR]]></dc:creator><pubDate>Thu, 26 Apr 2012 23:34:51 GMT</pubDate></item><item><title><![CDATA[Reply to The program has unexpectedly finished on Thu, 26 Apr 2012 23:22:12 GMT]]></title><description><![CDATA[<p dir="auto">[quote author="MuldeR" date="1335481183"][quote author="Flurite" date="1335481107"]I think you are trying to say that I am dereferencing a garbage pointer? I saw that problem from the start, but I didn't know how to fix it.[/quote]</p>
<p dir="auto">You can do it, for example, like the code in my previous post:<br />
<a href="http://qt-project.org/forums/viewthread/16697/#83748%5B/quote%5D" target="_blank" rel="noopener noreferrer nofollow ugc">http://qt-project.org/forums/viewthread/16697/#83748[/quote]</a></p>
<p dir="auto">Darn good idea. It's working now.. should have remembered using the <code>this</code> pointer to clarify some scope problems. Thanks!</p>
]]></description><link>https://forum.qt.io/post/137159</link><guid isPermaLink="true">https://forum.qt.io/post/137159</guid><dc:creator><![CDATA[Flurite]]></dc:creator><pubDate>Thu, 26 Apr 2012 23:22:12 GMT</pubDate></item><item><title><![CDATA[Reply to The program has unexpectedly finished on Thu, 26 Apr 2012 22:59:43 GMT]]></title><description><![CDATA[<p dir="auto">[quote author="Flurite" date="1335481107"]I think you are trying to say that I am dereferencing a garbage pointer? I saw that problem from the start, but I didn't know how to fix it.[/quote]</p>
<p dir="auto">You can do it, for example, like the code in my previous post:<br />
<a href="http://qt-project.org/forums/viewthread/16697/#83748" target="_blank" rel="noopener noreferrer nofollow ugc">http://qt-project.org/forums/viewthread/16697/#83748</a></p>
]]></description><link>https://forum.qt.io/post/137155</link><guid isPermaLink="true">https://forum.qt.io/post/137155</guid><dc:creator><![CDATA[MuldeR]]></dc:creator><pubDate>Thu, 26 Apr 2012 22:59:43 GMT</pubDate></item><item><title><![CDATA[Reply to The program has unexpectedly finished on Thu, 26 Apr 2012 22:58:27 GMT]]></title><description><![CDATA[<p dir="auto">[quote author="1+1=2" date="1335480901"]<br />
[quote author="Flurite" date="1335480406"]</p>
<p dir="auto">I am going to have more slots in my application, and I just do not want to clutter up the Clock_Application class.. I think by dividing it into multiple files will make it simpler.<br />
[/quote]</p>
<p dir="auto">That's OK.</p>
<p dir="auto">But  Stopwatch need to accept an private memeber of another Class now, so this is a bad design.</p>
<p dir="auto">[quote author="Flurite" date="1335480406"]<br />
Plus, does <code>ui</code> need to be defined if it's only used to access widgets?<br />
[/quote]<br />
No, Seems what you need is some basic knowledge of C++ ;-).[/quote]</p>
<p dir="auto">I think you are trying to say that I am dereferencing a garbage pointer? I saw that problem from the start, but I didn't know how to fix it. When I tried to replicate how Qt implemented the <code>ui</code> pointer, I never saw a definition for it, so that's why I thought I didn't need one for mine. Anyhow, I think I see the definition in the widget.cpp file now.</p>
]]></description><link>https://forum.qt.io/post/137154</link><guid isPermaLink="true">https://forum.qt.io/post/137154</guid><dc:creator><![CDATA[Flurite]]></dc:creator><pubDate>Thu, 26 Apr 2012 22:58:27 GMT</pubDate></item><item><title><![CDATA[Reply to The program has unexpectedly finished on Thu, 26 Apr 2012 22:55:01 GMT]]></title><description><![CDATA[<p dir="auto">[quote author="Flurite" date="1335480406"]</p>
<p dir="auto">I am going to have more slots in my application, and I just do not want to clutter up the Clock_Application class.. I think by dividing it into multiple files will make it simpler.<br />
[/quote]</p>
<p dir="auto">That's OK.</p>
<p dir="auto">But  Stopwatch need to accept an private memeber of another Class now, so this is a bad design.</p>
<p dir="auto">[quote author="Flurite" date="1335480406"]<br />
Plus, does <code>ui</code> need to be defined if it's only used to access widgets?<br />
[/quote]<br />
No, Seems what you need is some basic knowledge of C++ ;-).</p>
]]></description><link>https://forum.qt.io/post/137153</link><guid isPermaLink="true">https://forum.qt.io/post/137153</guid><dc:creator><![CDATA[dbzhang800]]></dc:creator><pubDate>Thu, 26 Apr 2012 22:55:01 GMT</pubDate></item><item><title><![CDATA[Reply to The program has unexpectedly finished on Thu, 26 Apr 2012 22:50:38 GMT]]></title><description><![CDATA[<p dir="auto">The problem is, that the "ui" in your Stopwatch class, that you defined as global variable, is not the same "ui" as the one in your Clock_Application application class, which is a member variable of the Clock_Application class itself. Consequently the value of the "ui" in your Stopwatch class is just an un-initialized pointer. You never assigned a value to it! Any access to <em>that</em> "ui" will cause crash or undefined behavior...</p>
<p dir="auto">Make the "ui" in your Stopwatch class a member variable of the Stopwatch class, rather than a global variable. Also you have to assign it to a value, so you have to pass through the "ui" from Clock_Application in the constructor of Stopwatch and then store it in the member variable...</p>
<p dir="auto">@class Stopwatch : public QObject<br />
{<br />
Q_OBJECT</p>
<pre><code>...
</code></pre>
<p dir="auto">private:<br />
QTimer* stopwatchTimer;<br />
Ui::Clock_Application *ui; //here we'll store the actual ui-Pointer<br />
};@</p>
<p dir="auto">@Stopwatch::Stopwatch(Ui::Clock_Application *ui)<br />
{<br />
this-&gt;ui = ui; //Now store the ui-Pointer we got from the Clock_Application!<br />
stopwatchTimer = 0;<br />
}@</p>
<p dir="auto">And in Clock_Application we do:</p>
<p dir="auto">@    Clock_Application::Clock_Application(QWidget *parent) :<br />
QMainWindow(parent),<br />
ui(new Ui::Clock_Application)<br />
{<br />
ui-&gt;setupUi(this);</p>
<pre><code>    myStopwatch = new Stopwatch(ui); // &lt;--- pass ui-Pointer over

    ....@
</code></pre>
]]></description><link>https://forum.qt.io/post/137152</link><guid isPermaLink="true">https://forum.qt.io/post/137152</guid><dc:creator><![CDATA[MuldeR]]></dc:creator><pubDate>Thu, 26 Apr 2012 22:50:38 GMT</pubDate></item><item><title><![CDATA[Reply to The program has unexpectedly finished on Thu, 26 Apr 2012 22:46:46 GMT]]></title><description><![CDATA[<p dir="auto">[quote author="1+1=2" date="1335479811"]Line 4 in your stopwatch.cpp:<br />
@<br />
Ui::Clock_Application* ui;<br />
@</p>
<p dir="auto">is a wild pointer too.</p>
<hr />
<p dir="auto">I don't know why your application designed in such pattern. If you delete the class Stopwatch, and implement such function in Clock_Application, it will become very simple and natural.[/quote]</p>
<p dir="auto">I am going to have more slots in my application, and I just do not want to clutter up the Clock_Application class.. I think by dividing it into multiple files will make it simpler. Plus, does <code>ui</code> need to be defined if it's only used to access widgets?</p>
]]></description><link>https://forum.qt.io/post/137151</link><guid isPermaLink="true">https://forum.qt.io/post/137151</guid><dc:creator><![CDATA[Flurite]]></dc:creator><pubDate>Thu, 26 Apr 2012 22:46:46 GMT</pubDate></item><item><title><![CDATA[Reply to The program has unexpectedly finished on Thu, 26 Apr 2012 22:43:40 GMT]]></title><description><![CDATA[<p dir="auto">[quote author="MuldeR" date="1335480007"]I think <em>Ui::Clock_Application* ui</em> is initialized and deleted correctly.<br />
[/quote]</p>
<p dir="auto">Yes, but it has nothing with the <em>ui</em> used in your stopwatch.cpp.</p>
]]></description><link>https://forum.qt.io/post/137150</link><guid isPermaLink="true">https://forum.qt.io/post/137150</guid><dc:creator><![CDATA[dbzhang800]]></dc:creator><pubDate>Thu, 26 Apr 2012 22:43:40 GMT</pubDate></item><item><title><![CDATA[Reply to The program has unexpectedly finished on Thu, 26 Apr 2012 22:40:07 GMT]]></title><description><![CDATA[<p dir="auto">I think <em>Ui::Clock_Application* ui</em> is initialized and deleted correctly.</p>
<p dir="auto">@Clock_Application::Clock_Application(QWidget *parent) :<br />
QMainWindow(parent),<br />
ui(new Ui::Clock_Application) // &lt;---<br />
{<br />
ui-&gt;setupUi(this);</p>
<pre><code>....@
</code></pre>
]]></description><link>https://forum.qt.io/post/137149</link><guid isPermaLink="true">https://forum.qt.io/post/137149</guid><dc:creator><![CDATA[MuldeR]]></dc:creator><pubDate>Thu, 26 Apr 2012 22:40:07 GMT</pubDate></item><item><title><![CDATA[Reply to The program has unexpectedly finished on Thu, 26 Apr 2012 22:36:51 GMT]]></title><description><![CDATA[<p dir="auto">Line 4 in your stopwatch.cpp:<br />
@<br />
Ui::Clock_Application* ui;<br />
@</p>
<p dir="auto">is a wild pointer too.</p>
<hr />
<p dir="auto">I don't know why your application designed in such pattern. If you delete the class Stopwatch, and implement such function in Clock_Application, it will become very simple and natural.</p>
]]></description><link>https://forum.qt.io/post/137148</link><guid isPermaLink="true">https://forum.qt.io/post/137148</guid><dc:creator><![CDATA[dbzhang800]]></dc:creator><pubDate>Thu, 26 Apr 2012 22:36:51 GMT</pubDate></item><item><title><![CDATA[Reply to The program has unexpectedly finished on Thu, 26 Apr 2012 22:34:56 GMT]]></title><description><![CDATA[<p dir="auto">Please post full code...</p>
]]></description><link>https://forum.qt.io/post/137147</link><guid isPermaLink="true">https://forum.qt.io/post/137147</guid><dc:creator><![CDATA[MuldeR]]></dc:creator><pubDate>Thu, 26 Apr 2012 22:34:56 GMT</pubDate></item><item><title><![CDATA[Reply to The program has unexpectedly finished on Thu, 26 Apr 2012 22:33:33 GMT]]></title><description><![CDATA[<p dir="auto">Sorry, I think I was posting the wrong code. The program becomes unresponsive when I actually include DO NOT include the delete statement. When I do include the delete statement, the connections disconnect (I think..) and the program just doesn't do anything.</p>
<p dir="auto"><em>Late post: Alright, I will give your most recent post a shot</em></p>
]]></description><link>https://forum.qt.io/post/137146</link><guid isPermaLink="true">https://forum.qt.io/post/137146</guid><dc:creator><![CDATA[Flurite]]></dc:creator><pubDate>Thu, 26 Apr 2012 22:33:33 GMT</pubDate></item><item><title><![CDATA[Reply to The program has unexpectedly finished on Thu, 26 Apr 2012 22:31:31 GMT]]></title><description><![CDATA[<p dir="auto">[quote author="Flurite" date="1335479359"]Oh yeah, that delete was pointless. Anyhow, where do you suspect the problem is?[/quote]</p>
<p dir="auto">You can't just remove the delete. When the function goes out of scope, you'll loose the pointer to your Stopwatch object, because <em>connectorClass</em> is a local variable. The object still exists, but you don't have any pointer to it. This will cause a memory leak, because you won't be able to delete it later...</p>
<p dir="auto">I'd recommend to make <em>connectorClass</em> a member variable. And don't forget the <em>delete</em> in the deconstructor!</p>
]]></description><link>https://forum.qt.io/post/137145</link><guid isPermaLink="true">https://forum.qt.io/post/137145</guid><dc:creator><![CDATA[MuldeR]]></dc:creator><pubDate>Thu, 26 Apr 2012 22:31:31 GMT</pubDate></item><item><title><![CDATA[Reply to The program has unexpectedly finished on Thu, 26 Apr 2012 22:29:24 GMT]]></title><description><![CDATA[<p dir="auto">You are doing strange things there: First you create a new Stopwatch object on the heap (with "new" command) and store the pointer in a local variable. That is okay, so far. Then you connect some signals to the newly created Stopwatch object by using your local pointer. Still okay. But then you delete the object? Huh? In the best case Qt will automatically remove the connection you just created when the object is destroyed. In the worst case it does not and you have a connection to a non-existing object. This is going to cause unexpected behavior and may even lead to application crash...</p>
<p dir="auto">[EDIT] Sorry, 1+1=2 was faster ;-) [/EDIT]</p>
]]></description><link>https://forum.qt.io/post/137144</link><guid isPermaLink="true">https://forum.qt.io/post/137144</guid><dc:creator><![CDATA[MuldeR]]></dc:creator><pubDate>Thu, 26 Apr 2012 22:29:24 GMT</pubDate></item><item><title><![CDATA[Reply to The program has unexpectedly finished on Thu, 26 Apr 2012 22:29:19 GMT]]></title><description><![CDATA[<p dir="auto">Oh yeah, that delete was pointless. Anyhow, where do you suspect the problem is?</p>
]]></description><link>https://forum.qt.io/post/137143</link><guid isPermaLink="true">https://forum.qt.io/post/137143</guid><dc:creator><![CDATA[Flurite]]></dc:creator><pubDate>Thu, 26 Apr 2012 22:29:19 GMT</pubDate></item><item><title><![CDATA[Reply to The program has unexpectedly finished on Thu, 26 Apr 2012 22:26:47 GMT]]></title><description><![CDATA[<p dir="auto">[quote author="Flurite" date="1335478572"]</p>
<p dir="auto">When I click any of the buttons, the program becomes unresponsive.. this is unusual, as my slot functions were working completely fine before I decided to make a separate class for my timer[/quote]</p>
<p dir="auto">If so, somewhere else must have a problem too.</p>
<p dir="auto">In addition, lines 11-15 in you widget.cpp <em>do nothing</em> now.</p>
<p dir="auto">@<br />
Stopwatch* connectorClass = new Stopwatch;<br />
connect(ui-&gt;Stopwatch_Start, SIGNAL(clicked()), connectorClass, SLOT(timer_Start()));<br />
connect(ui-&gt;Stopwatch_Pause, SIGNAL(clicked()), connectorClass, SLOT(timer_Pause()));<br />
connect(ui-&gt;Stopwatch_Reset, SIGNAL(clicked()), connectorClass, SLOT(timer_Reset()));<br />
delete connectorClass;<br />
@</p>
]]></description><link>https://forum.qt.io/post/137142</link><guid isPermaLink="true">https://forum.qt.io/post/137142</guid><dc:creator><![CDATA[dbzhang800]]></dc:creator><pubDate>Thu, 26 Apr 2012 22:26:47 GMT</pubDate></item><item><title><![CDATA[Reply to The program has unexpectedly finished on Thu, 26 Apr 2012 22:16:12 GMT]]></title><description><![CDATA[<p dir="auto">Thanks for pointing that out. This is my new implementation of my class:</p>
<p dir="auto">@<br />
#include "widget_definitions.h"<br />
#include "ui_clock_application.h"<br />
#include "stopwatch_definitions.h"</p>
<p dir="auto">Clock_Application::Clock_Application(QWidget *parent) :<br />
QMainWindow(parent),<br />
ui(new Ui::Clock_Application)<br />
{<br />
ui-&gt;setupUi(this);</p>
<pre><code>Stopwatch* connectorClass = new Stopwatch;
connect(ui-&gt;Stopwatch_Start, SIGNAL(clicked()), connectorClass, SLOT(timer_Start()));
connect(ui-&gt;Stopwatch_Pause, SIGNAL(clicked()), connectorClass, SLOT(timer_Pause()));
connect(ui-&gt;Stopwatch_Reset, SIGNAL(clicked()), connectorClass, SLOT(timer_Reset()));
delete connectorClass;
</code></pre>
<p dir="auto">}</p>
<p dir="auto">Clock_Application::~Clock_Application()<br />
{<br />
delete ui;<br />
}<br />
@</p>
<p dir="auto">When I click any of the buttons, the program becomes unresponsive.. this is unusual, as my slot functions were working completely fine before I decided to make a separate class for my timer</p>
]]></description><link>https://forum.qt.io/post/137141</link><guid isPermaLink="true">https://forum.qt.io/post/137141</guid><dc:creator><![CDATA[Flurite]]></dc:creator><pubDate>Thu, 26 Apr 2012 22:16:12 GMT</pubDate></item><item><title><![CDATA[Reply to The program has unexpectedly finished on Thu, 26 Apr 2012 21:15:28 GMT]]></title><description><![CDATA[<p dir="auto">Line 11 in your widget.cpp<br />
@<br />
Stopwatch* connectorClass;<br />
@<br />
It is a wild pointer which point to random memory.</p>
]]></description><link>https://forum.qt.io/post/137135</link><guid isPermaLink="true">https://forum.qt.io/post/137135</guid><dc:creator><![CDATA[dbzhang800]]></dc:creator><pubDate>Thu, 26 Apr 2012 21:15:28 GMT</pubDate></item></channel></rss>