Skip to content
Snippets Groups Projects
Unverified Commit 7c4a4f5a authored by meskio's avatar meskio :tent:
Browse files

Quit if there was an initializaton error

Let's close properly without segfaults :)
parent abb65c7f
No related branches found
No related tags found
No related merge requests found
......@@ -20,12 +20,14 @@ ApplicationWindow {
donate.visible = true
}
if (ctx.errors ) {
// TODO consider disabling on/off buttons, or quit after closing the dialog
if ( ctx.errors == "nohelpers" ) {
showInitFailure(qsTr("Could not find helpers. Check your installation"))
} else if ( ctx.errors == "nopolkit" ) {
showInitFailure(qsTr("Could not find polkit agent."))
} else {
//: %1 -> application name
//: %2 -> error string
showInitFailure(qsTr("Got an error starting %1: %2").arg(ctx.appName).arg(ctx.errors))
console.debug(ctx.errors)
}
}
......@@ -248,5 +250,7 @@ ApplicationWindow {
title: qsTr("Initialization Error")
text: ""
visible: false
onAccepted: backend.quit()
onRejected: backend.quit()
}
}
......@@ -4,7 +4,6 @@ package backend
import (
"C"
"fmt"
"log"
"strconv"
"unsafe"
......@@ -31,7 +30,9 @@ func Quit() {
} else {
ctx.cfg.SetUserStoppedVPN(true)
}
ctx.bm.Close()
if ctx.bm != nil {
ctx.bm.Close()
}
}
func DonateAccepted() {
......@@ -55,7 +56,9 @@ func InitializeBitmaskContext(opts *InitOpts) {
initOnce.Do(func() { initializeContext(opts) })
runDonationReminder()
go ctx.updateStatus()
if ctx.bm != nil {
go ctx.updateStatus()
}
}
func RefreshContext() *C.char {
......
......@@ -45,6 +45,7 @@ func initializeBitmask(errCh chan string, opts *InitOpts) {
os.Exit(1)
}
bitmask.InitializeLogger()
ctx.cfg = config.ParseConfig()
b, err := bitmask.InitializeBitmask(opts.SkipLaunch)
if err != nil {
......@@ -70,5 +71,4 @@ func initializeBitmask(errCh chan string, opts *InitOpts) {
}
ctx.bm = b
ctx.cfg = config.ParseConfig()
}
......@@ -230,7 +230,8 @@ func bitmaskRootPath() (string, error) {
return path, nil
}
}
return "", errors.New("No bitmask-root found")
log.Println("Can't find bitmask-root")
return "", errors.New("nohelpers")
}
func getOpenvpnPath() string {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment