Skip to content

Commit

Permalink
fix(gtk): panic on windows 11 and mac (#1650)
Browse files Browse the repository at this point in the history
  • Loading branch information
Ja7ad authored Dec 21, 2024
1 parent 721e5f4 commit abf3836
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 7 deletions.
2 changes: 1 addition & 1 deletion cmd/gtk/assets/ui/widget_node.ui
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,7 @@
<property name="valign">start</property>
<property name="hexpand">True</property>
<property name="vexpand">True</property>
<property name="label" translatable="yes">📡 Connections</property>
<property name="label" translatable="yes">📡 Connections:</property>
</object>
<packing>
<property name="left-attach">0</property>
Expand Down
8 changes: 6 additions & 2 deletions cmd/gtk/dialog_about.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (

"github.com/gotk3/gotk3/gdk"
"github.com/gotk3/gotk3/gtk"
"github.com/pactus-project/pactus/cmd"
"github.com/pactus-project/pactus/version"
)

Expand All @@ -25,9 +26,12 @@ func aboutDialog() *gtk.AboutDialog {
dlg := getAboutDialogObj(builder, "id_dialog_about")

pxLogo, err := gdk.PixbufNewFromBytesOnly(pactusLogo)
fatalErrorCheck(err)
if err != nil {
cmd.PrintErrorMsgf("Failed to load Logo Pixbuf: %v", err)
} else {
dlg.SetLogo(pxLogo)
}

dlg.SetLogo(pxLogo)
dlg.SetVersion(version.NodeVersion.StringWithAlias())

return dlg
Expand Down
8 changes: 4 additions & 4 deletions cmd/gtk/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,11 @@ func init() {
passwordOpt = flag.String("password", "", "wallet password")
testnetOpt = flag.Bool("testnet", false, "initializing for the testnet")
version.NodeAgent.AppType = "gui"

// the gtk on macos should run on main thread.
if runtime.GOOS == "darwin" {
runtime.UnlockOSThread()
runtime.LockOSThread()
}
runtime.UnlockOSThread()
runtime.LockOSThread()

gtk.Init(nil)
}

Expand Down

0 comments on commit abf3836

Please sign in to comment.