forked from Leak_Technologies/VideoTools
Guard drag handler with recover and nil checks
This commit is contained in:
parent
fdb0f44fa7
commit
32434dbc28
|
|
@ -275,6 +275,14 @@ func setupDragDest(p *pane, win *gtk.Window) {
|
|||
// DragDestSet requires at least one target; use the URI target.
|
||||
p.area.DragDestSet(gtk.DEST_DEFAULT_ALL, []gtk.TargetEntry{*target}, gdk.ACTION_COPY)
|
||||
p.area.Connect("drag-data-received", func(_ *gtk.DrawingArea, ctx *gdk.DragContext, x, y int, data *gtk.SelectionData, info uint, t uint32) {
|
||||
defer func() {
|
||||
if r := recover(); r != nil {
|
||||
log.Printf("drag handler panic: %v", r)
|
||||
}
|
||||
}()
|
||||
if data == nil {
|
||||
return
|
||||
}
|
||||
uris := data.GetURIs()
|
||||
if len(uris) == 0 {
|
||||
return
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user