Skip to content

Commit

Permalink
linux save file panic fix
Browse files Browse the repository at this point in the history
  • Loading branch information
atterpac committed Apr 7, 2024
1 parent e6a84ef commit 589d1fb
Showing 1 changed file with 5 additions and 14 deletions.
19 changes: 5 additions & 14 deletions v3/pkg/application/linux_cgo.go
Original file line number Diff line number Diff line change
Expand Up @@ -1583,25 +1583,17 @@ func runChooserDialog(window pointer, allowMultiple, createFolders, showHidden b
// Canceled
}
}
var response C.gint

// If multiselect
if allowMultiple {
// Multi-select is ran in main thread in an upstream function with error return
response := C.gtk_dialog_run((*C.GtkDialog)(fc))
go func() {
handleReponse(response)
}()
C.gtk_widget_destroy((*C.GtkWidget)(fc))
response = C.gtk_dialog_run((*C.GtkDialog)(fc))
} else {
// Single select needs to be on main thread
InvokeAsync(func() {
response := C.gtk_dialog_run((*C.GtkDialog)(fc))
go func() {
handleReponse(response)
}()
C.gtk_widget_destroy((*C.GtkWidget)(fc))
response = C.gtk_dialog_run((*C.GtkDialog)(fc))
})
}
go handleReponse(response)
C.gtk_widget_destroy((*C.GtkWidget)(fc))
return selections, nil
}

Expand Down Expand Up @@ -1712,6 +1704,5 @@ func runSaveFileDialog(dialog *SaveFileDialogStruct) (chan string, error) {
buttonText,
dialog.filters)

close(results)
return results, err
}

0 comments on commit 589d1fb

Please sign in to comment.