Fix progress races (windows).
This commit is contained in:
parent
15dc2768c4
commit
b743781dc8
1 changed files with 4 additions and 0 deletions
|
@ -21,6 +21,8 @@ func progress(opts options) (ProgressDialog, error) {
|
||||||
}
|
}
|
||||||
if opts.ctx == nil {
|
if opts.ctx == nil {
|
||||||
opts.ctx = context.Background()
|
opts.ctx = context.Background()
|
||||||
|
} else if cerr := opts.ctx.Err(); cerr != nil {
|
||||||
|
return nil, cerr
|
||||||
}
|
}
|
||||||
|
|
||||||
dlg := &progressDialog{
|
dlg := &progressDialog{
|
||||||
|
@ -43,6 +45,7 @@ func progress(opts options) (ProgressDialog, error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func progressDlg(opts options, dlg *progressDialog) (err error) {
|
func progressDlg(opts options, dlg *progressDialog) (err error) {
|
||||||
|
defer dlg.init.Done()
|
||||||
defer setup()()
|
defer setup()()
|
||||||
font := getFont()
|
font := getFont()
|
||||||
defer font.Delete()
|
defer font.Delete()
|
||||||
|
@ -170,6 +173,7 @@ func progressDlg(opts options, dlg *progressDialog) (err error) {
|
||||||
} else {
|
} else {
|
||||||
sendMessage.Call(dlg.progCtl, 0x406 /* PBM_SETRANGE32 */, 0, uintptr(opts.maxValue))
|
sendMessage.Call(dlg.progCtl, 0x406 /* PBM_SETRANGE32 */, 0, uintptr(opts.maxValue))
|
||||||
}
|
}
|
||||||
|
defer dlg.init.Add(1)
|
||||||
dlg.init.Done()
|
dlg.init.Done()
|
||||||
|
|
||||||
if opts.ctx != nil {
|
if opts.ctx != nil {
|
||||||
|
|
Loading…
Reference in a new issue