This is an automated email from the ASF dual-hosted git repository. btashton pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/incubator-nuttx-apps.git
The following commit(s) were added to refs/heads/master by this push: new fce08ec arch/sim: Fix NXWM test failure fce08ec is described below commit fce08ec0299a6f6a4b50d8a669276bdcf4693dc0 Author: Sebastian Ene <s...@apache.org> AuthorDate: Sat Oct 31 13:55:10 2020 +0200 arch/sim: Fix NXWM test failure ## Summary of changes Fixed the crash caused by a NULL memory access to an invalid background window. Signed-off-by: Sebastian Ene <s...@apache.org> --- graphics/nxwm/src/ctaskbar.cxx | 24 +++++++++++++++++++++--- include/graphics/nxwm/ctaskbar.hxx | 2 +- 2 files changed, 22 insertions(+), 4 deletions(-) diff --git a/graphics/nxwm/src/ctaskbar.cxx b/graphics/nxwm/src/ctaskbar.cxx index 7f3f381..d243fd1 100644 --- a/graphics/nxwm/src/ctaskbar.cxx +++ b/graphics/nxwm/src/ctaskbar.cxx @@ -70,7 +70,7 @@ using namespace NxWM; CTaskbar::CTaskbar(void) { m_taskbar = (NXWidgets::CNxWindow *)0; - m_background = (NXWidgets::CNxWindow *)0; + m_background = (NXWidgets::CBgWindow *)0; m_backImage = (NXWidgets::CImage *)0; m_topApp = (IApplication *)0; m_started = false; @@ -163,7 +163,7 @@ void CTaskbar::disconnect(void) // Then delete the background delete m_background; - m_background = (NXWidgets::CNxWindow *)0; + m_background = (NXWidgets::CBgWindow *)0; } // Delete the background image @@ -972,9 +972,27 @@ bool CTaskbar::createTaskbarWindow(void) bool CTaskbar::createBackgroundWindow(void) { + CWindowMessenger *control = new CWindowMessenger((NXWidgets::CWidgetStyle *)NULL); + // Create a raw window to present the background image - m_background = openRawWindow(); + NXWidgets::CBgWindow *background = getBgWindow(control); + if (!background) + { + delete control; + return false; + } + + // Open (and initialize) the BG window + + bool success = background->open(); + if (!success) + { + delete background; + return false; + } + + m_background = background; if (!m_background) { return false; diff --git a/include/graphics/nxwm/ctaskbar.hxx b/include/graphics/nxwm/ctaskbar.hxx index d595abd..1ba1d7b 100644 --- a/include/graphics/nxwm/ctaskbar.hxx +++ b/include/graphics/nxwm/ctaskbar.hxx @@ -101,7 +101,7 @@ namespace NxWM */ NXWidgets::CNxWindow *m_taskbar; /**< The task bar window */ - NXWidgets::CNxWindow *m_background; /**< The background window */ + NXWidgets::CBgWindow *m_background; /**< The background window */ NXWidgets::CImage *m_backImage; /**< The background image */ IApplication *m_topApp; /**< The top application in the hierarchy */ TNxArray<struct STaskbarSlot> m_slots; /**< List of application slots in the task bar */