Fix context issue

This commit is contained in:
Lea Anthony
2022-01-25 16:27:39 -06:00
committed by Travis McLane
parent 6c68e59113
commit 4f3c14f25b
+7 -8
View File
@@ -78,12 +78,14 @@ func CreateApp(appoptions *options.App) (*App, error) {
ctx = context.WithValue(ctx, "events", eventHandler)
messageDispatcher := dispatcher.NewDispatcher(myLogger, appBindings, eventHandler)
appFrontend := desktop.NewFrontend(ctx, appoptions, myLogger, appBindings, messageDispatcher)
eventHandler.AddFrontend(appFrontend)
debug := IsDebug()
ctx = context.WithValue(ctx, "debug", debug)
// Attach logger to context
ctx = context.WithValue(ctx, "logger", myLogger)
appFrontend := desktop.NewFrontend(ctx, appoptions, myLogger, appBindings, messageDispatcher)
eventHandler.AddFrontend(appFrontend)
result := &App{
ctx: ctx,
frontend: appFrontend,
@@ -91,13 +93,10 @@ func CreateApp(appoptions *options.App) (*App, error) {
menuManager: menuManager,
startupCallback: appoptions.OnStartup,
shutdownCallback: appoptions.OnShutdown,
debug: IsDebug(),
debug: debug,
options: appoptions,
}
result.options = appoptions
result.ctx = context.WithValue(result.ctx, "debug", result.debug)
return result, nil
}