Fix some decryption crashes

This commit is contained in:
Xpl0itU 2023-08-11 18:19:19 +02:00
parent cb8a63a0c6
commit 305caf35f9

View file

@ -15,6 +15,7 @@ extern void callProgressCallback(int progress);
import "C" import "C"
import ( import (
"fmt" "fmt"
"time"
"unsafe" "unsafe"
"github.com/gotk3/gotk3/gtk" "github.com/gotk3/gotk3/gtk"
@ -37,11 +38,14 @@ func DecryptContents(path string, progress *ProgressWindow, deleteEncryptedConte
progress.bar.SetText("Decrypting...") progress.bar.SetText("Decrypting...")
for progressInt := range progressChan { for progressInt := range progressChan {
if progressInt > 0 {
progress.bar.SetFraction(float64(progressInt) / 100) progress.bar.SetFraction(float64(progressInt) / 100)
for gtk.EventsPending() { for gtk.EventsPending() {
gtk.MainIteration() gtk.MainIteration()
} }
} }
time.Sleep(time.Millisecond * 10)
}
if err := <-errorChan; err != nil { if err := <-errorChan; err != nil {
return err return err