@@ -350,6 +350,7 @@ void SDL_Portal_ShowFileDialogWithProperties(SDL_FileDialogType type, SDL_Dialog
350
350
}
351
351
352
352
SDL_DBusContext * dbus = SDL_DBus_GetContext ();
353
+ DBusError error ;
353
354
DBusMessage * msg ;
354
355
DBusMessageIter params , options ;
355
356
const char * signal_id = NULL ;
@@ -361,6 +362,8 @@ void SDL_Portal_ShowFileDialogWithProperties(SDL_FileDialogType type, SDL_Dialog
361
362
362
363
const char * err_msg = validate_filters (filters , nfilters );
363
364
365
+ dbus -> error_init (& error );
366
+
364
367
if (err_msg ) {
365
368
SDL_SetError ("%s" , err_msg );
366
369
callback (userdata , NULL , -1 );
@@ -459,7 +462,13 @@ void SDL_Portal_ShowFileDialogWithProperties(SDL_FileDialogType type, SDL_Dialog
459
462
}
460
463
dbus -> message_iter_close_container (& params , & options );
461
464
462
- DBusMessage * reply = dbus -> connection_send_with_reply_and_block (dbus -> session_conn , msg , DBUS_TIMEOUT_INFINITE , NULL );
465
+ DBusMessage * reply = dbus -> connection_send_with_reply_and_block (dbus -> session_conn , msg , DBUS_TIMEOUT_INFINITE , & error );
466
+ if (dbus -> error_is_set (& error )) {
467
+ SDL_SetError ("Failed to open dialog via DBus, %s: %s" , error .name , error .message );
468
+ dbus -> error_free (& error );
469
+ goto cleanup ;
470
+ }
471
+
463
472
if (reply ) {
464
473
DBusMessageIter reply_iter ;
465
474
dbus -> message_iter_init (reply , & reply_iter );
@@ -485,9 +494,15 @@ void SDL_Portal_ShowFileDialogWithProperties(SDL_FileDialogType type, SDL_Dialog
485
494
}
486
495
487
496
SDL_snprintf (filter , filter_len , SIGNAL_FILTER "%s'" , signal_id );
488
- dbus -> bus_add_match (dbus -> session_conn , filter , NULL );
497
+ dbus -> bus_add_match (dbus -> session_conn , filter , & error );
489
498
SDL_free (filter );
490
499
500
+ if (dbus -> error_is_set (& error )) {
501
+ SDL_SetError ("Failed to set up DBus listener for dialog, %s: %s" , error .name , error .message );
502
+ dbus -> error_free (& error );
503
+ goto cleanup ;
504
+ }
505
+
491
506
SignalCallback * data = SDL_malloc (sizeof (SignalCallback ));
492
507
if (!data ) {
493
508
callback (userdata , NULL , -1 );
0 commit comments