GUI_MEMDEV_Delete():second question.

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

  • GUI_MEMDEV_Delete():second question.

    Dear sirs,

    proceeding with problems in GUI_MEMDEV_Delete(md) function, I found the following:
    - if you call GUI_MEMDEV_Delete(md) and md=0, it works (I saw debugging in assembly that if parameter passed is 0, it returns immediately);


    - if you call GUI_MEMDEV_Delete(md) and md!=0, it works ONLY IF md was created (so md!=0) and is still "alive";

    - if you call GUI_MEMDEV_Delete(md) and md!=0 but md was previously already deleted, it crashes.
    Now, it is clear that there is no reasons to delete an already deleted md, but in a complex application maybe you need to delete ALL memory devices in a certain instant... so you run a for cycle to delete all of them.
    Moreover, there is no function to reveal if a memory device is effectively active or if it was deleted (for example, if you use GUI_MEMDEV_GetDataPtr(md) and md was previously deleted, it crashes; I expected that if md is still active it returns a pointer, while if md was already deleted it returns NULL).

    Working with emWin 5.18, LPC1788 from NXP, emWin5.18 is the precompiled library donloaded from LPCware web site.

    Best regards,

    Valter

  • Hi Adrian,


    ok I'll try to explain better.
    This post is related to my previous one (you answered today) Strange behaviour on GUI_MEMDEV_Delete() function created last 8 january by me.
    Normally I create memory devices as follow:
    md = GUI_MEMDEV_CreateFixed(X,Y,SIZEX,SIZEY,GUI_MEMDEV_NOTRANS,GUI_MEMDEV_APILIST_32,GUI_COLOR_CONV_888 );


    - if md creation is successfull, md is assigned with an integer value !=0;
    - if md creation fails, md=0 is assigned;


    now here are 3 situations I described:
    A)
    just after processor reset, I assign all my variables =0, so md=0;
    if I call GUI_MEMDEV_Delete(md) and md=0, it works (I saw debugging in assembly that if parameter passed is 0, it returns immediately);
    this is ok because I didn't still created memory device md;


    B)
    just after processor reset, I assign all my variables =0, so md=0; then I create successfully memory device:
    md = GUI_MEMDEV_CreateFixed(X,Y,SIZEX,SIZEY,GUI_MEMDEV_NOTRANS,GUI_MEMDEV_APILIST_32,GUI_COLOR_CONV_888 ).
    If I call GUI_MEMDEV_Delete(md) and md!=0, it works: md exists and I can destroy it;


    C)
    just after processor reset, I assign all my variables =0, so md=0; then I create successfully memory device:
    md = GUI_MEMDEV_CreateFixed(X,Y,SIZEX,SIZEY,GUI_MEMDEV_NOTRANS,GUI_MEMDEV_APILIST_32,GUI_COLOR_CONV_888 ).
    When I call GUI_MEMDEV_Delete(md) the first time, it works as described above in point B) BUT IF I CALL AGAIN GUI_MEMDEV_Delete(md) I HAVE A PROCESSOR CRASH.
    Now, it is clear that there is no reasons to delete an already deleted md, but in a complex application maybe you need to delete ALL memory devices in a
    certain instant... so you run a for cycle to delete all of them.
    Moreover, there is no function to reveal if a memory device is effectively active or if it was deleted (for example, if you use GUI_MEMDEV_GetDataPtr(md)
    and md was already deleted, it crashes; I expected that if md is still active it returns a pointer, while if md was deleted it returns NULL).


    I hope this clarify.


    Thank you and best regards,


    Valter




    The post was edited 2 times, last by valterrasicci ().