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,10 +38,13 @@ func DecryptContents(path string, progress *ProgressWindow, deleteEncryptedConte
progress.bar.SetText("Decrypting...") progress.bar.SetText("Decrypting...")
for progressInt := range progressChan { for progressInt := range progressChan {
progress.bar.SetFraction(float64(progressInt) / 100) if progressInt > 0 {
for gtk.EventsPending() { progress.bar.SetFraction(float64(progressInt) / 100)
gtk.MainIteration() for gtk.EventsPending() {
gtk.MainIteration()
}
} }
time.Sleep(time.Millisecond * 10)
} }
if err := <-errorChan; err != nil { if err := <-errorChan; err != nil {