aboutsummaryrefslogtreecommitdiffstats
path: root/app/status.go
Commit message (Collapse)AuthorAgeFilesLines
* app: fix nil pointer dereference on startupRobin Jarry2023-10-111-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fix the following crash on startup: panic: runtime error: invalid memory address or nil pointer dereference [signal SIGSEGV: segmentation violation code=0x1 addr=0x80 pc=0x9e2314] goroutine 1 [running]: git.sr.ht/~rjarry/aerc/log.PanicHandler() git.sr.ht/~rjarry/aerc/log/panic-logger.go:51 +0x70f panic({0xae95a0, 0x119f9b0}) runtime/panic.go:890 +0x263 git.sr.ht/~rjarry/aerc/app.(*Aerc).SelectedAccount(0x8503cdd28?) git.sr.ht/~rjarry/aerc/app/aerc.go:384 +0x14 git.sr.ht/~rjarry/aerc/app.SelectedAccount(...) git.sr.ht/~rjarry/aerc/app/app.go:44 git.sr.ht/~rjarry/aerc/app.(*AccountView).isSelected(...) git.sr.ht/~rjarry/aerc/app/account.go:225 git.sr.ht/~rjarry/aerc/app.(*AccountView).UpdateStatus(0x850364380) git.sr.ht/~rjarry/aerc/app/account.go:127 +0x28 git.sr.ht/~rjarry/aerc/app.(*AccountView).SetStatus(0x850364380, {0x850243a50, 0x1, 0x0?}) git.sr.ht/~rjarry/aerc/app/account.go:123 +0x94 git.sr.ht/~rjarry/aerc/app.NewAccountView(0x8503d38c0, 0x85041bf80) git.sr.ht/~rjarry/aerc/app/account.go:111 +0x573 git.sr.ht/~rjarry/aerc/app.NewAerc({0xcab0c0?, 0x11fa3c8}, 0x850433860, 0xbf3040, {0xca75e8?, 0x11ca800}, 0x0?) git.sr.ht/~rjarry/aerc/app/aerc.go:91 +0x6ce git.sr.ht/~rjarry/aerc/app.Init(...) git.sr.ht/~rjarry/aerc/app/app.go:24 main.main() git.sr.ht/~rjarry/aerc/main.go:242 +0x52e There was two things very wrong: - Access of the global aerc pointer before it was initialized. - The host field of AccountView was left there and still accessed but never initialized. Replace the global aerc pointer with a real struct value. Update code accordingly. Remove the AccountView.host field which is now useless. Reported-by: Jens Grassel <jens@wegtam.com> Reported-by: Matěj Cepl <mcepl@cepl.eu> Fixes: bc176bd61ba7 ("app: export global functions") Signed-off-by: Robin Jarry <robin@jarry.cc> Tested-by: Moritz Poldrack <moritz@poldrack.dev>
* app: export global functionsRobin Jarry2023-10-101-8/+3
| | | | | | | | | | | | | | | The single Aerc object is passed around in almost all command functions. This hinders readability. Store the single Aerc instance as a global variable. Export public functions from the app package to access methods of that object. Remove all explicit references to *app.Aerc and replace them with calls to these functions. For references to private/unexported fields and functions from within the app package, directly access the global aerc object. Signed-off-by: Robin Jarry <robin@jarry.cc> Acked-by: Moritz Poldrack <moritz@poldrack.dev>
* widgets: rename package to appRobin Jarry2023-10-101-0/+166
This is the central point of all aerc. Having it named widgets is confusing. Rename it to app. It will make a cleaner transition when making the app.Aerc object available globally in the next commit. Signed-off-by: Robin Jarry <robin@jarry.cc> Acked-by: Moritz Poldrack <moritz@poldrack.dev>