Skip to content
This repository was archived by the owner on Apr 7, 2026. It is now read-only.
This repository was archived by the owner on Apr 7, 2026. It is now read-only.

Release Method #8

Description

@bicoi

Hi,

I have a question related to "release" method of MediaPlayer and Player class.

  1. In MediaPlayer class, when we call release() we will release Player and set this value to null (mPlayer = null).
  2. In Player class we will send message "MSG_STOP" to EventHandler stop other threads,

But EventHandle will handle "MSG_STOP" in another thread, so have a case a command "mPlayer = null" is run while we are processing "MSG_STOP". When "mPlayer = null" is set I think app will be crashed, because we are referencing to mPlayer in EventHandle.

Could you give your advice about this situation? Or I have misunderstood anything?

In the case it has problem, could I use "sendMessageAndAwaitResponse(nMsg)" instead of "mEventHandler.sendMessageAtFrontOfQueue(nMsg)" in release method of Player?

Thanks,

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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