@@ -4119,6 +4119,7 @@ void WaylandThread::selection_set_text(const String &p_text) {
41194119
41204120 if (registry.wl_data_device_manager == nullptr ) {
41214121 DEBUG_LOG_WAYLAND_THREAD (" Couldn't set selection, wl_data_device_manager global not available." );
4122+ return ;
41224123 }
41234124
41244125 if (ss == nullptr ) {
@@ -4246,17 +4247,22 @@ void WaylandThread::primary_set_text(const String &p_text) {
42464247 return ;
42474248 }
42484249
4250+ if (ss->wp_primary_selection_device == nullptr ) {
4251+ DEBUG_LOG_WAYLAND_THREAD (" Couldn't set primary selection, seat doesn't have wp_primary_selection_device." );
4252+ return ;
4253+ }
4254+
42494255 ss->primary_data = p_text.to_utf8_buffer ();
42504256
42514257 if (ss->wp_primary_selection_source == nullptr ) {
42524258 ss->wp_primary_selection_source = zwp_primary_selection_device_manager_v1_create_source (registry.wp_primary_selection_device_manager );
42534259 zwp_primary_selection_source_v1_add_listener (ss->wp_primary_selection_source , &wp_primary_selection_source_listener, ss);
42544260 zwp_primary_selection_source_v1_offer (ss->wp_primary_selection_source , " text/plain;charset=utf-8" );
42554261 zwp_primary_selection_source_v1_offer (ss->wp_primary_selection_source , " text/plain" );
4256- }
42574262
4258- // TODO: Implement a good way of getting the latest serial from the user.
4259- 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 ));
4263+ // TODO: Implement a good way of getting the latest serial from the user.
4264+ 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 ));
4265+ }
42604266
42614267 // Wait for the message to get to the server before continuing, otherwise the
42624268 // clipboard update might come with a delay.
0 commit comments