Freeing TPopupMenu caused access violation

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #32841
    ehimmer
    Participant

    I received an Access Violation during a FreeAndNil of a dynamically created TPopupMenu using AC version 6.04. I just updated to 6.22 and the code at the point of the Access Violation seems to be the same so I suspect this error is still potentially there… anyway, here is the stack order:

    FreeAndNil(myPopupMenu)
    TCustomerForm.Notification
    TsToolBar.Notification
    TsSkinableMenus.HookPopupMenu

    The first thing it does in that HookPupupMenu is:
    Menu.OwnerDraw := Active;

    And that is where the Access Violation occured. Note: Active should be false since it is being removed.

    If the timing is right on the FreeAndNil, wouldn't the parameter Menu be nil? That would explain the AV… so, if you haven't already, I think you might want to check to be sure Menu is not nil first. Or put a try-except block around all of that.

    Or is there something I should do before freeing the menu?

    #38656
    Support
    Keymaster

    Hello
    I'll try to reproduce and solve this problem soon, if you can send me an example where problem is exists, then send it please )

    #38680
    ehimmer
    Participant

    QUOTE (Support @ Apr 16 2009, 03:34 AM)
    Hello
    I'll try to reproduce and solve this problem soon, if you can send me an example where problem is exists, then send it please )


    That's a tough request… it probably works 99.9% of the time. I just happened to have received a single bug report (EurekaLog generated), that showed it occurred in the sequence I mentioned. I've tried to repro without success, but for now I've gone ahead an added a try-except around my FreeAndNil in hopes to avoid the generation of a bug report for something that is probably safe to ignore.

    Maybe I can automate an example so that is does it rapidly over and over… maybe it will catch the problem then.

    #38734
    Support
    Keymaster

    Ok, if you will catch this error in the future – could you save and show me an EurekaLog report?

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.