GNOME Bugzilla – Bug 567491
gparamspecs.c param_double_validate() always fails NaN/Inf/-Inf values
Last modified: 2018-05-24 11:40:39 UTC
Please describe the problem: Double properties can not currently receive NaN/Inf/-Inf values because param_double_validate() does not allow for them. The CLAMP() logic will always fail. To preserve existing behavior, properties must continue to reject these values, but GParamSpecDouble should be modified to include allow_nan/allow_inf fields so that a property can allow such values. Steps to reproduce: Actual results: Expected results: Does this happen every time? Other information:
Created attachment 126270 [details] [review] Patch to GParamSpecDouble and param_double_validate()
I would like someone to test this on MSVC since it has different built-ins for the math functions. I don't have an environment set up here to easily test.
Ouch, I didn't notice that GParamSpecDouble has not a single flag yet and needs structure size change to support this. Unfortunately this (or whatever similar patch) has to wait until GLib 3.0 :-(
That is why I was suggesting an implicit workaround for GLib 2. I was suggesting that if the app had not explicitly set a minimum/maximum value (the defaults are -G_MAXDOUBLE/G_MAXDOUBLE), then NaN/Inf/-Inf would be allowed. If the app did in fact set an explicit range, then they would be rejected. It is not ideal, but it is the only real way I can see to avoid a structure change on GParamSpecDouble.
-- GitLab Migration Automatic Message -- This bug has been migrated to GNOME's GitLab instance and has been closed from further activity. You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.gnome.org/GNOME/glib/issues/183.