mirror of
https://github.com/octoleo/syncthing.git
synced 2024-12-22 10:58:57 +00:00
Repair buggy BringToFront
This commit is contained in:
parent
5143c09bcf
commit
9b5e8aaf83
@ -53,9 +53,15 @@ func (q *jobQueue) BringToFront(filename string) {
|
||||
q.mut.Lock()
|
||||
defer q.mut.Unlock()
|
||||
|
||||
for i := range q.queued {
|
||||
if q.queued[i] == filename {
|
||||
q.queued[0], q.queued[i] = q.queued[i], q.queued[0]
|
||||
for i, cur := range q.queued {
|
||||
if cur == filename {
|
||||
if i > 0 {
|
||||
// Shift the elements before the selected element one step to
|
||||
// the right, overwriting the selected element
|
||||
copy(q.queued[1:i+1], q.queued[0:])
|
||||
// Put the selected element at the front
|
||||
q.queued[0] = cur
|
||||
}
|
||||
return
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user