mirror of https://github.com/GNOME/gimp.git
libgimp, libgimpbase: fix passing a file spec action through the wire.
I forgot to set meta.m_file.action into the GPParamDef! 🤦
As a side update, let's store the action as gint32 in GPParamDefFile. I
realized that otherwise, depending on the actual size of an enum type,
when casting to a (guint32 *), we crop the value! This works out in
Little Endian because we are only in small number territory, but in Big
Endian, we would always crop any action value to 0!
This was not the bug in this specific case, but it could become the
exact same bug (always passing action 0, i.e. OPEN, through the wire) on
Big Endian hardware.
This commit is contained in:
parent
8db404516e
commit
d25c97e7c9
|
@ -352,7 +352,7 @@ _gimp_gp_param_def_to_param_spec (const GPParamDef *param_def)
|
|||
file = g_file_new_for_uri (param_def->meta.m_file.default_uri);
|
||||
|
||||
pspec = gimp_param_spec_file (name, nick, blurb,
|
||||
param_def->meta.m_file.action,
|
||||
(GimpFileChooserAction) param_def->meta.m_file.action,
|
||||
param_def->meta.m_file.none_ok,
|
||||
file, flags);
|
||||
g_clear_object (&file);
|
||||
|
@ -673,6 +673,7 @@ _gimp_param_spec_to_gp_param_def (GParamSpec *pspec,
|
|||
|
||||
param_def->param_def_type = GP_PARAM_DEF_TYPE_FILE;
|
||||
|
||||
param_def->meta.m_file.action = (gint32) fspec->action;
|
||||
param_def->meta.m_file.none_ok = fspec->none_ok;
|
||||
param_def->meta.m_file.default_uri =
|
||||
ospec->_default_value ? g_file_get_uri (G_FILE (ospec->_default_value)) : NULL;
|
||||
|
|
|
@ -243,9 +243,10 @@ struct _GPParamDefResource
|
|||
|
||||
struct _GPParamDefFile
|
||||
{
|
||||
GimpFileChooserAction action;
|
||||
gint32 none_ok;
|
||||
gchar *default_uri;
|
||||
/* action is a GimpFileChooserAction casted to gint32. */
|
||||
gint32 action;
|
||||
gint32 none_ok;
|
||||
gchar *default_uri;
|
||||
};
|
||||
|
||||
struct _GPParamDef
|
||||
|
|
Loading…
Reference in New Issue