internal/pipewire: export Registry::Destroy
All checks were successful
Test / Create distribution (push) Successful in 1m32s
Test / Hakurei (push) Successful in 8m23s
Test / Sandbox (push) Successful in 1m35s
Test / Sandbox (race detector) (push) Successful in 2m18s
Test / Hakurei (race detector) (push) Successful in 3m9s
Test / Hpkg (push) Successful in 3m19s
Test / Flake checks (push) Successful in 1m31s
All checks were successful
Test / Create distribution (push) Successful in 1m32s
Test / Hakurei (push) Successful in 8m23s
Test / Sandbox (push) Successful in 1m35s
Test / Sandbox (race detector) (push) Successful in 2m18s
Test / Hakurei (race detector) (push) Successful in 3m9s
Test / Hpkg (push) Successful in 3m19s
Test / Flake checks (push) Successful in 1m31s
This handles the error returned by Sync. Signed-off-by: Ophestra <cat@gensokyo.uk>
This commit is contained in:
@@ -641,6 +641,37 @@ func (registry *Registry) destroy(id Int) error {
|
||||
)
|
||||
}
|
||||
|
||||
// Destroy tries to destroy the global object with id.
|
||||
func (registry *Registry) Destroy(id Int) error {
|
||||
if err := registry.destroy(id); err != nil {
|
||||
return err
|
||||
}
|
||||
destroySeq := registry.ctx.currentSeq()
|
||||
|
||||
err := registry.ctx.GetCore().Sync()
|
||||
if err == nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
var coreError *CoreError
|
||||
if proxyErrors, ok := err.(ProxyConsumeError); !ok ||
|
||||
len(proxyErrors) != 1 ||
|
||||
!errors.As(proxyErrors[0], &coreError) ||
|
||||
coreError == nil ||
|
||||
coreError.ID != registry.ID ||
|
||||
coreError.Sequence != destroySeq {
|
||||
return err
|
||||
}
|
||||
|
||||
switch syscall.Errno(-coreError.Result) {
|
||||
case syscall.EPERM:
|
||||
return &PermissionError{registry.ID, coreError.Message}
|
||||
|
||||
default:
|
||||
return coreError
|
||||
}
|
||||
}
|
||||
|
||||
// An UnsupportedObjectTypeError is the name of a type not known by the server [Registry].
|
||||
type UnsupportedObjectTypeError string
|
||||
|
||||
|
||||
Reference in New Issue
Block a user