Skip to content

SimplePlayer not exiting correctly when still playing #49

@anjemor

Description

@anjemor

When working on my program, this issue occured and required some time to solve it. When testing my programs, I like to quickly close them with a press on ESC. This should also have worked, while a song is paused or playing. So I looked again at SimplePlayer to see if it happens there also. And yes (starting under Lazarus 64 bit with debug on), when the test.ogg is still playing and you close the program, then the heap tracer shows an error. It is not very specific about the cause - just something about uos_Play, which is not quite the culprit.
I don't want to bother you with all the things I've tried, at the end it turned out it was uos_EndProc in combination with uos_free in FormDestroy.
There are several ways to solve this:

  • Application.ProcessMessages; after uos_free
  • the content of FormDestroy to FormClose
  • uos_EndProc(PlayerIndex1, NIL); after button6.Click, then even sleep and ProcessMessages is not needed, it seems
  • or some weird combinations of the above

I don't quite understand the reason for this, but at least it has something to do with the time, when EndProc is called. Maybe at the wrong time, EndProc points to a form method which is already gone?
Tests have to be made with all combinations of play, pause, stop, looped and non-looped!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions