GLib-CRITICAL assert when I use spice-client-glib-2.0.
I am use spice-client-glib-2.0 for the first time, I want to coding a spice client by qt.but I refer to spciy's code implementation to establish a spice session and always report an error:
(process:12948): GLib-CRITICAL **: 14:14:12.970: g_datalist_id_set_data_full: assertion 'key_id > 0' failed.
(process:12948): GLib-GObject-CRITICAL **: 14:14:12.970: g_param_spec_pool_lookup: assertion 'pool != NULL' failed.
(process:12948): GLib-GObject-WARNING **: 14:14:12.970: g_object_set_is_valid_property: object class '(null)' has no property named 'uri'.
(process:12948): GLib-CRITICAL **: 14:14:12.970: g_datalist_id_set_data_full: assertion 'key_id > 0' failed.
(process:12948): GLib-GObject-CRITICAL **: 14:14:12.970: g_param_spec_pool_lookup: assertion 'pool != NULL' failed.
(process:12948): GLib-GObject-WARNING **: 14:14:12.970: g_object_set_is_valid_property: object class '(null)' has no property named 'host'.
(process:12948): GLib-CRITICAL **: 14:14:12.970: g_datalist_id_set_data_full: assertion 'key_id > 0' failed.
(process:12948): GLib-GObject-CRITICAL **: 14:14:12.970: g_param_spec_pool_lookup: assertion 'pool != NULL' failed.
(process:12948): GLib-GObject-WARNING **: 14:14:12.970: g_object_set_is_valid_property: object class '(null)' has no property named 'port'.
(process:12948): GLib-GObject-WARNING **: 14:14:12.970: ../gobject/gsignal.c:2523: signal 'channel-new' is invalid for instance '0x7f6bd8c76190' of type '(null)'.
(process:12948): GLib-GObject-CRITICAL **: 14:14:12.970: g_param_spec_pool_lookup: assertion 'pool != NULL' failed.
(process:12948): GLib-GObject-WARNING **: 14:14:12.970: g_object_get_is_valid_property: object class '(null)' has no property named 'host'.
CODE attached:
bool qt_spice::init(const char *host, int port) {
LOG_WARN << get_log_prefix() << "spiceSession's addr: " << spiceSession;
spiceSession = spice_session_new();
LOG_WARN << get_log_prefix() << "spiceSession's addr: " << spiceSession;
if (nullptr == spiceSession) {
LOG_ERR << get_log_prefix() << "Create spice session failed.";
return false;
}
LOG_WARN << get_log_prefix() << "host: " << host << ", port: " << port;
std::string uri = "spice://";
uri.append(host);
uri.append(":");
uri.append(std::to_string(port));
LOG_WARN << get_log_prefix() << "uri: " << uri;
g_object_set(spiceSession, "uri", uri.c_str(), nullptr);
g_object_set(spiceSession, "host", host, nullptr);
g_object_set(spiceSession, "port", port, nullptr);
g_signal_connect(spiceSession, "channel-new", G_CALLBACK(channel_new), this);
spice_set_session_option(spiceSession);
char test[20] = {};
g_object_get(spiceSession, "host", &test, nullptr);
LOG_WARN << get_log_prefix() << "#######" << test;
if (!spice_session_connect(spiceSession)) {
LOG_ERR << get_log_prefix() << "spice_session_connect failed.";
return false;
}
return true;
}
spice-protocol version: 0.14.1 (and 0.12.14).
spice-gtk version: 0.29.
glib version: 0.26.
Please help me check the problem,THX.