GUI_MEMDEV_BlendWinBk causing exception

    This site uses cookies. By continuing to browse this site, you are agreeing to our Cookie Policy.

    • GUI_MEMDEV_BlendWinBk causing exception


      I am facing a problem related to GUI_MEMDEV_BlendWinBk .

      I display 6-7 windows one after another in my application. Please see my flow below,

      1) Display Window 1 - after some delay delete window 1 and display window 2
      2) Display Window 2 - on button click delete window 2 and display window 3
      3) Display Window 3 - on button click delete window 3 and display window 2
      4) Display Window 2 - after some delay delete Window 2 and display window 4
      5) Display Window 4 - on button click delete Window 4 and display window 5
      6) Display Window 5 - on button click delete Window 5 and display window 6
      7) Display Window 6 - on button click display window 7 and call GUI_MEMDEV_BlendWinBk on WM init for window 7 to blend background window.

      I get an exception at GUI_MEMDEV_BlendWinBk call. Attached is the error.

      the weird part is when points 2, 3, 4 are skipped the GUI_MEMDEV_BlendWinBk does not give exception and result is as expected.
      i.e. if after window 1 i directly show window 4 and proceed further as per points then the exception is not shown.
      when the exception is thrown the window 7 handle is 4 and when exception does not come the window 7 handle is 48.

      I think i have allocated sufficient memory to emwin by by #define GUI_NUMBYTES 0x1000000.
      Not sure what is causing the issue here.
      Do i have to clear any memory other than WM_DeleteWindow?

      unfortunately i cannot share the code.
      Please point me to a direction from where i can proceed.


      • Capture.PNG

        21.72 kB, 481×234, viewed 88 times
    • Hello,

      Thanks for your reply.

      I cannot share the code but i debugged the issue and found that when i reduce the widgets from the widget resource table then the issue is not observed

      const GUI_WIDGET_CREATE_INFO ScreenWidgetTable[] = { \
      { WINDOW_CreateIndirect, NULL,GUI_ID_WINDOW_0,0,0,0,0,0, 0, 0 },
      { BUTTON_CreateIndirect, "CANCEL", GUI_ID_BUTTON_CANCEL,0,0,0,0,0, 0, 0 },
      { BUTTON_CreateIndirect, "CONFIRM", GUI_ID_BUTTON_CONFIRM,0,0,0,0,0, 0, 0 },
      //{ TEXT_CreateIndirect,"",GUI_ID_TEXT_VARIABLE_TITLE, 0, 0, 0, 0, 0, 0, 0 },
      //{ TEXT_CreateIndirect,NULL,GUI_ID_TEXT_OPTION1,0,0,0,0,0, 0, 0 },
      //{ TEXT_CreateIndirect,NULL,GUI_ID_TEXT_OPTION2,0,0,0,0,0, 0, 0 },
      //{ EDIT_CreateIndirect,NULL,GUI_ID_EDIT_VAL,0,0,0,0,0, 0, 0 },
      //{ BUTTON_CreateIndirect, NULL,GUI_ID_BUTTON_DOWN,0,0,0,0,0, 0, 0 },
      //{ BUTTON_CreateIndirect, NULL,GUI_ID_BUTTON_UP,0,0,0,0,0, 0, 0 },

      please ignore the x,y, and size parameters in above table as i have purposely set them to zero to make the table readable to you.

      when i uncomment the 4th line i,e, { TEXT_CreateIndirect,"",GUI_ID_TEXT_VARIABLE_TITLE, 0, 0, 0, 0, 0, 0, 0 }, or any further line
      then the issue with the crash is observed. i have tried uncommenting the button widget entries below and comment the text entry but still same issue.

      it seems if the widgets are increased the crash issue is observed.

      please let me know what could be the issue?

    • Hello,

      I used the latest version 6.14 simulation and my same code worked fine without any issue.
      I am currently using 5.48 version.

      I observed the emwin memory usage by using GUI_ALLOC_GetMaxUsedBytes and in 6.14 version the usage bytes is almost double than in case of 5.48 version.

      Version 5.48 and 6.10 give me the same application crash issue with GUI_MEMDEV_BlendWinBk but issue is not present for 6.14 version.
      Is this an issue with 5.48 version not allocating enough memory?