@@ -4111,6 +4111,7 @@ void WaylandThread::selection_set_text(const String &p_text) {
41114111
41124112 if (registry.wl_data_device_manager == nullptr ) {
41134113 DEBUG_LOG_WAYLAND_THREAD (" Couldn't set selection, wl_data_device_manager global not available." );
4114+ return ;
41144115 }
41154116
41164117 if (ss == nullptr ) {
@@ -4238,17 +4239,22 @@ void WaylandThread::primary_set_text(const String &p_text) {
42384239 return ;
42394240 }
42404241
4242+ if (ss->wp_primary_selection_device == nullptr ) {
4243+ DEBUG_LOG_WAYLAND_THREAD (" Couldn't set primary selection, seat doesn't have wp_primary_selection_device." );
4244+ return ;
4245+ }
4246+
42414247 ss->primary_data = p_text.to_utf8_buffer ();
42424248
42434249 if (ss->wp_primary_selection_source == nullptr ) {
42444250 ss->wp_primary_selection_source = zwp_primary_selection_device_manager_v1_create_source (registry.wp_primary_selection_device_manager );
42454251 zwp_primary_selection_source_v1_add_listener (ss->wp_primary_selection_source , &wp_primary_selection_source_listener, ss);
42464252 zwp_primary_selection_source_v1_offer (ss->wp_primary_selection_source , " text/plain;charset=utf-8" );
42474253 zwp_primary_selection_source_v1_offer (ss->wp_primary_selection_source , " text/plain" );
4248- }
42494254
4250- // TODO: Implement a good way of getting the latest serial from the user.
4251- zwp_primary_selection_device_v1_set_selection (ss->wp_primary_selection_device , ss->wp_primary_selection_source , MAX (ss->pointer_data .button_serial , ss->last_key_pressed_serial ));
4255+ // TODO: Implement a good way of getting the latest serial from the user.
4256+ zwp_primary_selection_device_v1_set_selection (ss->wp_primary_selection_device , ss->wp_primary_selection_source , MAX (ss->pointer_data .button_serial , ss->last_key_pressed_serial ));
4257+ }
42524258
42534259 // Wait for the message to get to the server before continuing, otherwise the
42544260 // clipboard update might come with a delay.
0 commit comments