Skip to content

GitLab

  • Projects
  • Groups
  • Snippets
  • Help
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
L
libao
  • Project overview
    • Project overview
    • Details
    • Activity
    • Releases
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 32
    • Issues 32
    • List
    • Boards
    • Labels
    • Service Desk
    • Milestones
  • Merge Requests 3
    • Merge Requests 3
  • CI / CD
    • CI / CD
    • Pipelines
    • Jobs
    • Schedules
  • Operations
    • Operations
    • Incidents
    • Environments
  • Packages & Registries
    • Packages & Registries
    • Container Registry
  • Analytics
    • Analytics
    • CI / CD
    • Repository
    • Value Stream
  • Wiki
    • Wiki
  • Members
    • Members
  • Collapse sidebar
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
  • Xiph.Org
  • libao
  • Issues
  • #1763

Closed
Open
Opened Dec 13, 2010 by Philipp Schafft@ph3-der-loewe🦁Maintainer

[PATCH] ao_initialize() and ao_shutdown() should be stacked

The following situation: Two parts of a program, for example program itself and a 3rd party plugin tries to access libao.

At the moment they need to signalize each other that ao_initialize() was already called, and when ao_shutdown() must be called. This is a bad thing when it comes to 3rd party code not under your (direct) control.

If you call them multiple times stuff may be left in inconsistent state, memory leak or wrong pointers (after a very quick look at the code).

The solution I see is to have a reference counter like counter. If it is zero and ao_initialize() is called the init is done and counter is set to one. if it is non-zero nothing is done but to increment the counter. ao_shutdown() works exactly the other way: each time it is called the counter is decremented. If it falls to zero the actual shutdown is done.

Assignee
Assign to
None
Milestone
None
Assign milestone
Time tracking
None
Due date
None
Reference: xiph/libao#1763