color-profile: Rely on property on ICC for filename
This is instead of getting anything from the CdDevice. This avoids a crash when CdDevice isn't successfully setup but something still tries to look up the filename of the ICC profile. This isn't a real bug fix for anything, but there is no reason having to rely on CdDevice for this anyway, and as we don't really have control of it, it's less reliable of containing something valid. Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2622>
This commit is contained in:
parent
fa1bb402d3
commit
3aecb1c262
@ -790,6 +790,7 @@ save_icc_profile (const char *file_path,
|
||||
static CdIcc *
|
||||
create_icc_profile_from_edid (MetaColorDevice *color_device,
|
||||
const MetaEdidInfo *edid_info,
|
||||
const char *file_path,
|
||||
GError **error)
|
||||
{
|
||||
MetaColorManager *color_manager = color_device->color_manager;
|
||||
@ -839,6 +840,7 @@ create_icc_profile_from_edid (MetaColorDevice *color_device,
|
||||
return NULL;
|
||||
}
|
||||
|
||||
cd_icc_add_metadata (cd_icc, CD_PROFILE_PROPERTY_FILENAME, file_path);
|
||||
cd_icc_add_metadata (cd_icc,
|
||||
CD_PROFILE_METADATA_DATA_SOURCE,
|
||||
CD_PROFILE_METADATA_DATA_SOURCE_EDID);
|
||||
@ -923,7 +925,9 @@ create_device_profile_from_edid (MetaColorDevice *color_device,
|
||||
"Generating ICC profile for '%s' from EDID",
|
||||
meta_color_device_get_id (color_device));
|
||||
|
||||
cd_icc = create_icc_profile_from_edid (color_device, edid_info, &error);
|
||||
cd_icc = create_icc_profile_from_edid (color_device,
|
||||
edid_info, file_path,
|
||||
&error);
|
||||
if (!cd_icc)
|
||||
{
|
||||
g_task_return_error (task, g_steal_pointer (&error));
|
||||
@ -939,9 +943,6 @@ create_device_profile_from_edid (MetaColorDevice *color_device,
|
||||
return;
|
||||
}
|
||||
|
||||
/* Set metadata needed by colord */
|
||||
cd_icc_add_metadata (cd_icc, CD_PROFILE_PROPERTY_FILENAME, file_path);
|
||||
|
||||
file_md5_checksum = g_compute_checksum_for_bytes (G_CHECKSUM_MD5, bytes);
|
||||
cd_icc_add_metadata (cd_icc, CD_PROFILE_METADATA_FILE_CHECKSUM,
|
||||
file_md5_checksum);
|
||||
|
@ -377,7 +377,8 @@ meta_color_profile_get_id (MetaColorProfile *color_profile)
|
||||
const char *
|
||||
meta_color_profile_get_file_path (MetaColorProfile *color_profile)
|
||||
{
|
||||
return cd_profile_get_filename (color_profile->cd_profile);
|
||||
return cd_icc_get_metadata_item (color_profile->cd_icc,
|
||||
CD_PROFILE_PROPERTY_FILENAME);
|
||||
}
|
||||
|
||||
const char *
|
||||
|
@ -132,7 +132,6 @@ create_profile_from_contents (MetaColorStore *color_store,
|
||||
|
||||
bytes = g_bytes_new (contents, size);
|
||||
|
||||
/* Set metadata needed by colord */
|
||||
cd_icc_add_metadata (cd_icc, CD_PROFILE_PROPERTY_FILENAME,
|
||||
file_path);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user