System File Chooser on Linux: check whether required GSettings schemas are installed to avoid application crash (issue #1069)

occurred on NixOS with Plasma (KDE) desktop
This commit is contained in:
Karl Tauber
2026-01-11 12:17:34 +01:00
parent edda52048c
commit 82759c2472
2 changed files with 24 additions and 2 deletions

View File

@@ -3,8 +3,11 @@ FlatLaf Change Log
## 3.7.1-SNAPSHOT
- System File Chooser: Update current filter before invoking approve callback
and after closing dialog. (issue #1065)
- System File Chooser:
- Update current filter before invoking approve callback and after closing
dialog. (issue #1065)
- On Linux: Check whether required GSettings schemas are installed to avoid
application crash (occurred on NixOS with Plasma/KDE desktop). (issue #1069)
- ComboBox: Added UI property `ComboBox.buttonFocusedEditableBackground`. (issue
#1068)
- Popup: Fixed scrolling popup painting issue on Windows 10 when a glass pane is

View File

@@ -33,6 +33,9 @@ extern Window getWindowHandle( JNIEnv* env, JAWT* awt, jobject window, Display**
// declare internal methods
static jobjectArray fileListToStringArray( JNIEnv* env, GSList* fileList );
// fields
static int settingsSchemaInstalled = -1;
//---- helper -----------------------------------------------------------------
#define isOptionSet( option ) ((optionsSet & com_formdev_flatlaf_ui_FlatNativeLinuxLibrary_ ## option) != 0)
@@ -188,6 +191,22 @@ JNIEXPORT jobjectArray JNICALL Java_com_formdev_flatlaf_ui_FlatNativeLinuxLibrar
if( !gtk_init_check( NULL, NULL ) )
return NULL;
// check whether required GSettings schemas are installed (e.g. on NixOS)
// this avoids output of following message on console, followed by an application crash:
// GLib-GIO-ERROR: No GSettings schemas are installed on the system
if( settingsSchemaInstalled < 0 ) {
GSettingsSchemaSource* schemaSource = g_settings_schema_source_get_default();
GSettingsSchema* schema = (schemaSource != NULL)
? g_settings_schema_source_lookup( schemaSource, "org.gtk.Settings.FileChooser", FALSE )
: NULL;
if( schema != NULL )
g_settings_schema_unref( schema );
settingsSchemaInstalled = (schema != NULL);
}
if( settingsSchemaInstalled <= 0 )
return NULL;
// convert Java strings to C strings
AutoReleaseStringUTF8 ctitle( env, title );
AutoReleaseStringUTF8 cokButtonLabel( env, okButtonLabel );