shithub: mycel

Download patch

ref: 20c9b3b3afc19bfc4cb218e7b0bd891f529f5a4e
parent: 49b9deeb4199bb7c9d402970fb2394a0a94f84dc
author: Philip Silva <[email protected]>
date: Fri Sep 24 11:51:02 EDT 2021

Remove error-prone free

- will be called eventually implicitly anyways
- use stdout for get messages

--- a/browser/browser.go
+++ b/browser/browser.go
@@ -1522,6 +1522,7 @@
 }
 
 func (b *Browser) loadUrl(url *url.URL) {
+	b.StatusCh <- fmt.Sprintf("Load %v...", url)
 	buf, contentType, err := b.get(url, true)
 	if err != nil {
 		log.Errorf("error loading %v: %v", url, err)
@@ -1599,9 +1600,7 @@
 }
 
 func (b *Browser) get(uri *url.URL, isNewOrigin bool) (buf []byte, contentType opossum.ContentType, err error) {
-	msg := fmt.Sprintf("Get %v", uri.String())
-	log.Printf(msg)
-	b.StatusCh <- msg
+	log.Infof(fmt.Sprintf("Get %v", uri.String()))
 	req, err := http.NewRequest("GET", uri.String(), nil)
 	if err != nil {
 		return
@@ -1630,10 +1629,7 @@
 }
 
 func (b *Browser) PostForm(uri *url.URL, data url.Values) (buf []byte, contentType opossum.ContentType, err error) {
-	b.Website.UI = &duit.Label{Text: "Posting..."}
-	dui.MarkLayout(dui.Top.UI)
-	dui.MarkDraw(dui.Top.UI)
-	dui.Render()
+	b.StatusCh <- "Posting..."
 	fb := strings.NewReader(escapeValues(b.Website.ContentType, data).Encode())
 	req, err := http.NewRequest("POST", uri.String(), fb)
 	if err != nil {
--- a/browser/duitx/scroll.go
+++ b/browser/duitx/scroll.go
@@ -67,9 +67,6 @@
 }
 
 func (ui *Scroll) Free() {
-	for _, tl := range ui.tiles {
-		tl.Free()
-	}
 	ui.tiles = make(map[int]*draw.Image)
 	ui.last = make(map[int]time.Time)
 }