diamondburned / dissent

Tiny native Discord app
https://flathub.org/apps/details/so.libdb.dissent
GNU General Public License v3.0
1.23k stars 39 forks source link

CRASH: invalid memory address or nil pointer dereference #145

Closed DodoLeDev closed 1 year ago

DodoLeDev commented 1 year ago

Hi!

First of all, thank you for making an absolutely lightweight Discord client that integrates seamlessly into the GNOME environment! :heart:

But today I faced a kinda strange error, panic: runtime error: invalid memory address or nil pointer dereference [recovered], which can be reproduced each time I follow these steps:

  1. Open a channel which has a YouTube video link
  2. Click on the embedded player: you'll have an error this video has no URL
  3. Change channel
  4. GTKcord4 crashes
Here is the backtrace: ``` panic: runtime error: invalid memory address or nil pointer dereference [recovered] panic: closure error: unexpected panic caught: runtime error: invalid memory address or nil pointer dereference Closure added at: github.com/diamondburned/gotk4/pkg/gtk/v4.(*Widget).ConnectUnmap at github.com/diamondburned/gotk4/pkg/gtk/v4/gtkwidget.go:1014 github.com/diamondburned/chatkit/components/embed.(*Embed).downloadVideo at github.com/diamondburned/chatkit/components/embed/embed.go:418 github.com/diamondburned/chatkit/components/embed.(*Embed).ActivateDefault at github.com/diamondburned/chatkit/components/embed/embed.go:500 [recovered] panic: closure error: unexpected panic caught: runtime error: invalid memory address or nil pointer dereference Closure added at: github.com/diamondburned/gotk4/pkg/gtk/v4.(*Widget).ConnectUnmap at github.com/diamondburned/gotk4/pkg/gtk/v4/gtkwidget.go:1014 github.com/diamondburned/chatkit/components/embed.(*Embed).downloadVideo at github.com/diamondburned/chatkit/components/embed/embed.go:418 github.com/diamondburned/chatkit/components/embed.(*Embed).ActivateDefault at github.com/diamondburned/chatkit/components/embed/embed.go:500 [signal SIGSEGV: segmentation violation code=0x1 addr=0x48 pc=0x55cb36d1e7e8] goroutine 1 [running]: github.com/diamondburned/gotk4/pkg/core/closure.(*FuncStack).TryRepanic(0xc0000061a0?) github.com/diamondburned/gotk4/pkg/core/closure/funcstack.go:118 +0xf9 panic({0x55cb375ef400, 0xc001434050}) runtime/panic.go:884 +0x213 github.com/diamondburned/gotk4/pkg/core/closure.(*FuncStack).Panicf(0xc0011ea9f0, {0x55cb371cd0df, 0x1b}, {0xc00042f250, 0x1, 0x1}) github.com/diamondburned/gotk4/pkg/core/closure/funcstack.go:104 +0x986 github.com/diamondburned/gotk4/pkg/core/closure.(*FuncStack).TryRepanic(0x55cb357d86e8?) github.com/diamondburned/gotk4/pkg/core/closure/funcstack.go:122 +0xc7 panic({0x55cb37679be0, 0x55cb393522c0}) runtime/panic.go:884 +0x213 github.com/diamondburned/gotk4/pkg/gtk/v4.BaseMediaStream(...) github.com/diamondburned/gotk4/pkg/gtk/v4/gtkmediastream.go:226 github.com/diamondburned/chatkit/components/embed.(*Embed).downloadVideo.func2() github.com/diamondburned/chatkit/components/embed/embed.go:421 +0x48 github.com/diamondburned/gotk4/pkg/gtk/v4._gotk4_gtk4_Widget_ConnectUnmap(0x55cb357cf3c6?, 0xc0000061a0?) github.com/diamondburned/gotk4/pkg/gtk/v4/gtkwidget_export.go:324 +0x74 github.com/diamondburned/gotk4/pkg/gtk/v4._Cfunc_gtk_stack_set_visible_child(0x7f8daab08900, 0x7f8d106903e0) _cgo_gotypes.go:45596 +0x48 github.com/diamondburned/gotk4/pkg/gtk/v4.(*Stack).SetVisibleChild.func1(0x7f8daab08900, 0x7f8daab08900?) github.com/diamondburned/gotk4/pkg/gtk/v4/gtkstack.go:830 +0x65 github.com/diamondburned/gotk4/pkg/gtk/v4.(*Stack).SetVisibleChild(0xc0002dd7d0, {0x55cb379c81b8?, 0xc0011a9200}) github.com/diamondburned/gotk4/pkg/gtk/v4/gtkstack.go:830 +0x9b github.com/diamondburned/gtkcord4/internal/window.(*ChatPage).switchTo(0xc0006da050, {0x55cb379c81b8?, 0xc0011a9200}) github.com/diamondburned/gtkcord4/internal/window/chat.go:215 +0x88 github.com/diamondburned/gtkcord4/internal/window.(*ChatPage).OpenChannel(0xc0006da050, 0x55cb375ccec0?) github.com/diamondburned/gtkcord4/internal/window/chat.go:200 +0x13c github.com/diamondburned/gtkcord4/internal/sidebar/channels.NewView.func3() github.com/diamondburned/gtkcord4/internal/sidebar/channels/channels.go:268 +0x1b2 github.com/diamondburned/gotk4/pkg/gtk/v4._gotk4_gtk4_TreeSelection_ConnectChanged(0x55cb357cf3c6?, 0xc0000061a0?) github.com/diamondburned/gotk4/pkg/gtk/v4/gtktreeselection_export.go:118 +0x74 github.com/diamondburned/gotk4/pkg/gio/v2._Cfunc_g_application_run(0x55cb3c0b9f80, 0x1, 0x7f8da8000e30) _cgo_gotypes.go:13959 +0x50 github.com/diamondburned/gotk4/pkg/gio/v2.(*Application).Run.func3(0xc00009c4d0?, 0x8?, 0x7f8da8000e30?) github.com/diamondburned/gotk4/pkg/gio/v2/gapplication_2_28.go:1266 +0x71 github.com/diamondburned/gotk4/pkg/gio/v2.(*Application).Run(0xc0002e3c80, {0xc000036220?, 0x1, 0x1}) github.com/diamondburned/gotk4/pkg/gio/v2/gapplication_2_28.go:1266 +0x1e5 github.com/diamondburned/gotkit/app.(*Application).Run(0xc0003fee00, {0xc000036220, 0x1, 0x1}) github.com/diamondburned/gotkit/app/app.go:272 +0x158 github.com/diamondburned/gotkit/app.(*Application).RunMain(0x55cb379bc170?) github.com/diamondburned/gotkit/app/app.go:277 +0x2e main.main() github.com/diamondburned/gtkcord4/main.go:60 +0x5e5 ```

Hope this helps!

diamondburned commented 1 year ago

Commit 10c6d2c should fix this. Please let me know if it does.

DodoLeDev commented 1 year ago

Yeah it fixes the issue! 👍🏼

Thanks a lot!