|
From: | Daniel J Sebald |
Subject: | Re: eliminating GUI event listener class |
Date: | Tue, 09 Apr 2013 03:52:08 -0500 |
User-agent: | Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.24) Gecko/20111108 Fedora/3.1.16-1.fc14 Thunderbird/3.1.16 |
On 04/08/2013 06:29 PM, John W. Eaton wrote:
On 04/08/2013 12:49 PM, Daniel J Sebald wrote:On 04/08/2013 11:23 AM, John W. Eaton wrote:The only thing we are using the event listener object for is to handle cleaning up the GUI when we exit from Octave. I tried to switch that to using signals and slots but was not successful. Can anyone explain the proper way to exit a Qt application like the one we have with multiple threads? Where does qtApp->quit need to be called?My guess is that you are issuing a signal from inside the Octave executable, which triggers the Octave thread to close, then returning to that code (no longer running) causes the crash. (The event listener approach initiates the closing of the application from the GUI thread side. There is probably a better way. Simply let Octave thread finish or terminate. There is a signal that is issued by the thread which can be connected to something on the GUI side before the Octave thread is started: http://qt-project.org/doc/qt-4.8/qthread.html#finished http://qt-project.org/doc/qt-4.8/qthread.html#terminated Create a slot that will close the GUI upon getting one (or both?) of those signals. Right now, GUI/IDE isn't saving modified files, so something needs to be fixed there.The attached change results in a segfault for me when exiting Octave either by calling exit at the command line or clicking to close the window. What am I doing wrong?
Connecting signal to signal...bold.I put some fprintf()s in the GUI code and noticed that none of them were occurring. Plus, the Octave crash message about attempting to write appeared. That indicated the seg fault was happening inside Octave. (If it were inside GUI, then Octave wouldn't have had a chance to continue to the message, or I would have seen one of the fprintf() messages.)
It looks like you removed a bit too much. Have to keep the part about flushing the gui_event_queue. Why exactly that causes a crash I'll leave for you to investigate. Attached is a diff. Try a diff between it and your diff file. I left in fprintf()s to make you aware of a few TODO items (e.g., need a destructor).
Dan
sans_event_listener_2013apr09.diff
Description: Text document
[Prev in Thread] | Current Thread | [Next in Thread] |