From 6cf694d2da5a661373a58c70e3d8e07cc8223eed Mon Sep 17 00:00:00 2001 From: patacongo Date: Fri, 18 May 2012 23:08:34 +0000 Subject: Final refactoring and implementation of delayed window deletion logic. Works worse now, but the changes are important and need to be checked in now git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@4747 42af7a65-404d-4744-a932-0658087f49c3 --- NxWidgets/nxwm/src/ccalibration.cxx | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) (limited to 'NxWidgets/nxwm/src/ccalibration.cxx') diff --git a/NxWidgets/nxwm/src/ccalibration.cxx b/NxWidgets/nxwm/src/ccalibration.cxx index 248aca838..d93f56a47 100644 --- a/NxWidgets/nxwm/src/ccalibration.cxx +++ b/NxWidgets/nxwm/src/ccalibration.cxx @@ -99,6 +99,11 @@ CCalibration::CCalibration(CTaskbar *taskbar, CFullScreenWindow *window, m_calthread = CALTHREAD_NOTRUNNING; m_calphase = CALPHASE_NOT_STARTED; m_touched = false; + + // Add our messenger as the window callback + + NXWidgets::CWidgetControl *control = window->getWidgetControl(); + control->addWindowEventHandler(&m_messenger); } /** @@ -112,6 +117,11 @@ CCalibration::~CCalibration(void) stop(); + // Remove ourself from the window callback + + NXWidgets::CWidgetControl *control = m_window->getWidgetControl(); + control->removeWindowEventHandler(&m_messenger); + // Although we did not create the window, the rule is that I have to dispose // of it @@ -199,6 +209,26 @@ void CCalibration::stop(void) } } +/** + * Destroy the application and free all of its resources. This method + * will initiate blocking of messages from the NX server. The server + * will flush the window message queue and reply with the blocked + * message. When the block message is received by CWindowMessenger, + * it will send the destroy message to the start window task which + * will, finally, safely delete the application. + */ + +void CCalibration::destroy(void) +{ + // Block any further window messages + + m_window->block(); + + // Make sure that the application is stopped + + stop(); +} + /** * The application window is hidden (either it is minimized or it is * maximized, but it is not at the top of the hierarchy) -- cgit v1.2.3