Possibly solved crashes on GTK's actions.
This commit is contained in:
parent
e487b8521c
commit
b1d38bbdcf
@ -308,7 +308,6 @@ func (m *MainWindow) hideOfflineFavoriteServers() {
|
||||
|
||||
func (m *MainWindow) loadAllServers(data map[string]string) {
|
||||
fmt.Println("Loading all servers...")
|
||||
// ToDo: do it without clearing.
|
||||
for _, server := range ctx.Cache.Servers {
|
||||
iter := new(gtk.TreeIter)
|
||||
ping, _ := strconv.Atoi(server.Server.Ping)
|
||||
@ -321,7 +320,7 @@ func (m *MainWindow) loadAllServers(data map[string]string) {
|
||||
}
|
||||
|
||||
if m.all_servers_hide_offline.GetActive() && (server.Server.Players == "" && server.Server.Maxplayers == "" || ping > 9000) {
|
||||
if server.AllServersIterInList {
|
||||
if server.AllServersIterInList && server.AllServersIterSet {
|
||||
m.all_servers_store.Remove(iter)
|
||||
server.AllServersIterInList = false
|
||||
}
|
||||
|
@ -11,6 +11,7 @@ import (
|
||||
"github.com/pztrn/urtrator/common"
|
||||
|
||||
// Other
|
||||
"github.com/mattn/go-gtk/gdk"
|
||||
"github.com/mattn/go-gtk/gdkpixbuf"
|
||||
"github.com/mattn/go-gtk/glib"
|
||||
"github.com/mattn/go-gtk/gtk"
|
||||
@ -18,6 +19,10 @@ import (
|
||||
|
||||
// Main window initialization.
|
||||
func (m *MainWindow) Initialize() {
|
||||
|
||||
gdk.ThreadsInit()
|
||||
gdk.ThreadsEnter()
|
||||
|
||||
gtk.Init(nil)
|
||||
|
||||
m.initializeStorages()
|
||||
@ -165,6 +170,7 @@ func (m *MainWindow) Initialize() {
|
||||
ctx.Eventer.LaunchEvent("setToolbarLabelText", map[string]string{"text": "URTrator is ready."})
|
||||
|
||||
gtk.Main()
|
||||
gdk.ThreadsLeave()
|
||||
}
|
||||
|
||||
// Events initialization.
|
||||
|
Reference in New Issue
Block a user