summaryrefslogtreecommitdiff
path: root/NxWidgets
diff options
context:
space:
mode:
authorpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2012-05-15 01:20:34 +0000
committerpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2012-05-15 01:20:34 +0000
commitdf1d64bd97cfc3039c113a258af134da6e6ba742 (patch)
tree454ac170d0580646b5559ff6f1fd0c1c31cfee13 /NxWidgets
parent1ac9219148610878491a20d15c87476451941eee (diff)
downloadpx4-nuttx-df1d64bd97cfc3039c113a258af134da6e6ba742.tar.gz
px4-nuttx-df1d64bd97cfc3039c113a258af134da6e6ba742.tar.bz2
px4-nuttx-df1d64bd97cfc3039c113a258af134da6e6ba742.zip
NxWM::CNxConsole when NSH window is closed by touching toolbar icon, need to suppress certain activities performed by the on_exit() handler
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@4739 42af7a65-404d-4744-a932-0658087f49c3
Diffstat (limited to 'NxWidgets')
-rw-r--r--NxWidgets/nxwm/src/cnxconsole.cxx34
1 files changed, 26 insertions, 8 deletions
diff --git a/NxWidgets/nxwm/src/cnxconsole.cxx b/NxWidgets/nxwm/src/cnxconsole.cxx
index 79baf67d9..855bd3d0b 100644
--- a/NxWidgets/nxwm/src/cnxconsole.cxx
+++ b/NxWidgets/nxwm/src/cnxconsole.cxx
@@ -287,12 +287,23 @@ bool CNxConsole::run(void)
void CNxConsole::stop(void)
{
- // Delete the NxConsole task if it is still running (this could strand resources).
+ // Delete the NxConsole task if it is still running (this could strand
+ // resources). If we get here due to CTaskbar::stopApplication() processing
+ // initialed by CNxConsole::exitHandler, then do *not* delete the task (it
+ // is already being delete).
if (m_pid >= 0)
{
- task_delete(m_pid);
+ // Calling task_delete() will also invoke the on_exit() handler. We se
+ // m_pid = -1 before calling task_delete() to let the on_exit() handler,
+ // CNxConsole::exitHandler(), know that it should not do anything
+
+ pid_t pid = m_pid;
m_pid = -1;
+
+ // Then delete the NSH task, possibly stranding resources
+
+ task_delete(pid);
}
// Destroy the NX console device
@@ -458,15 +469,22 @@ void CNxConsole::exitHandler(int code, FAR void *arg)
{
CNxConsole *This = (CNxConsole *)arg;
- // Set m_pid to -1 to prevent calling detlete_task() in CNxConsole::stop().
- // CNxConsole::stop() is called by the processing initiated by the following
- // call to CTaskbar::stopApplication()
+ // If we got here because of the task_delete() call in CNxConsole::stop(),
+ // then m_pid will be set to -1 to let us know that we do not need to do
+ // anything
- This->m_pid = -1;
+ if (This->m_pid >= 0)
+ {
+ // Set m_pid to -1 to prevent calling detlete_task() in CNxConsole::stop().
+ // CNxConsole::stop() is called by the processing initiated by the following
+ // call to CTaskbar::stopApplication()
+
+ This->m_pid = -1;
- // Remove the NxConsole application from the taskbar
+ // Remove the NxConsole application from the taskbar
- This->m_taskbar->stopApplication(This);
+ This->m_taskbar->stopApplication(This);
+ }
}
/**