[seahorse] Use string.data to convert a string to a uint8[]
- From: Niels De Graef <nielsdg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [seahorse] Use string.data to convert a string to a uint8[]
- Date: Tue, 11 Dec 2018 11:18:09 +0000 (UTC)
commit 7a541762e3308d57fb8fe3eca2e2fc445f79d9c9
Author: Niels De Graef <nielsdegraef gmail com>
Date: Tue Dec 11 12:15:46 2018 +0100
Use string.data to convert a string to a uint8[]
Otherwise, vala will pass on an array length of -1, which can crash in
some cases (such as `Bytes.new()`).
Fixes https://gitlab.gnome.org/GNOME/seahorse/issues/206.
common/key-manager-store.vala | 4 ++--
src/import-dialog.vala | 2 +-
2 files changed, 3 insertions(+), 3 deletions(-)
---
diff --git a/common/key-manager-store.vala b/common/key-manager-store.vala
index 404d8fd2..16a811ae 100644
--- a/common/key-manager-store.vala
+++ b/common/key-manager-store.vala
@@ -333,7 +333,7 @@ public class Seahorse.KeyManagerStore : Gcr.CollectionModel {
if (this.drag_objects != null) {
Gdk.Window? source_window = context.get_source_window();
Gdk.property_change (source_window, XDS_ATOM, TEXT_ATOM, 8, Gdk.PropMode.REPLACE,
- (uint8[]) XDS_FILENAME, XDS_FILENAME.length);
+ XDS_FILENAME.data, XDS_FILENAME.length);
}
debug("drag_begin <--");
@@ -398,7 +398,7 @@ public class Seahorse.KeyManagerStore : Gcr.CollectionModel {
return;
this.drag_destination = Path.get_dirname (destination);
- selection_data.set(selection_data.get_target(), 8, (uint8[]) "S");
+ selection_data.set(selection_data.get_target(), 8, "S".data);
}
// Unrecognized format
diff --git a/src/import-dialog.vala b/src/import-dialog.vala
index eda6bce7..a99dd191 100644
--- a/src/import-dialog.vala
+++ b/src/import-dialog.vala
@@ -55,7 +55,7 @@ public class Seahorse.ImportDialog : Gtk.Dialog {
}
public void add_text(string? display_name, string text) {
- this.viewer.load_data(display_name, (uint8[]) text);
+ this.viewer.load_data(display_name, text.data);
}
private void on_import_button_imported(GLib.Object importer, Error? error) {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]