Skip to content

Commit 987647a

Browse files
authored
Merge pull request #105 from williammartin/master
Fix suspected race condition in prompt handling
2 parents b0e756d + 70fd443 commit 987647a

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

secret_service/secret_service.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -186,12 +186,7 @@ func (s *SecretService) CreateItem(collection dbus.BusObject, label string, attr
186186
// the prompt to the user.
187187
func (s *SecretService) handlePrompt(prompt dbus.ObjectPath) (bool, dbus.Variant, error) {
188188
if prompt != dbus.ObjectPath("/") {
189-
err := s.Object(serviceName, prompt).Call(promptInterface+".Prompt", 0, "").Err
190-
if err != nil {
191-
return false, dbus.MakeVariant(""), err
192-
}
193-
194-
err = s.AddMatchSignal(dbus.WithMatchObjectPath(prompt),
189+
err := s.AddMatchSignal(dbus.WithMatchObjectPath(prompt),
195190
dbus.WithMatchInterface(promptInterface),
196191
)
197192
if err != nil {
@@ -205,6 +200,11 @@ func (s *SecretService) handlePrompt(prompt dbus.ObjectPath) (bool, dbus.Variant
205200
promptSignal := make(chan *dbus.Signal, 1)
206201
s.Signal(promptSignal)
207202

203+
err = s.Object(serviceName, prompt).Call(promptInterface+".Prompt", 0, "").Err
204+
if err != nil {
205+
return false, dbus.MakeVariant(""), err
206+
}
207+
208208
signal := <-promptSignal
209209
switch signal.Name {
210210
case promptInterface + ".Completed":

0 commit comments

Comments
 (0)