Commit Graph

8 Commits

Author SHA1 Message Date
48e14ef3b9 app, libgimpconfig: make various usage of g_file_replace() safer.
When an error occurs, we want to prevent overwriting any previous
version of the file by incomplete contents. So run
g_output_stream_close() with a cancelled GCancellable to do so.
See also discussion in #2565.

(cherry picked from commit 613bf7c5ab)
2018-12-07 00:51:05 +01:00
a88c0ffb93 Change the license URL from http://www.gnu.org/licenses/ to https:// 2018-07-11 23:47:19 +02:00
Ell
4569fdd34b app: explicitly close output stream when saving internal data
According to some bug reports, it seems that under some (unknown)
conditions we might save an empty custom gradient file on exit (for
equally unknown reasons).  The only difference in the way we save
internal data files, such as the custom gradient, compared to
gimp_data_save(), is the fact that we currently don't explicitly
close the output stream, but rather only unref it.

The output stream should be implicitly closed (and hence flushed)
upon destruction, but maybe the unreffing is not enough to
guarantee that it's actually destroyed (maybe it spawns an extra
reference for some reason, who knows.)  Anyway, let's just
explicitly close it, which also gives us a chance to catch and
report any errors occursing during flushing/closing (which,
altenatively, might be the culprit).

Additionally, a few more error-reporting improvements, to match
gimp_data_save().

(cherry picked from commit a72f7f1ace)
2018-07-02 11:48:49 -04:00
226367d6cb app: add GimpDataLoaderFactory which loads data from an array of formats
specified by GimpDataLoaderEntry structs. Remove the same code from
GimpDataFactory and make it an abstract base class that only serves as
an interface for actual implementations. Also move around some stuff
in GimpDataFactory and remove virtual functions that were a bad idea
in the first place.

(cherry picked from commit 73da7c9a54)
2018-06-04 14:35:51 +02:00
539927ebfa app: replace all g_assert() by the newly added gimp_assert()
which is just a #define to g_assert for now, but can now easily be
turned into something that does some nicer debugging using our new
stack trace infrastructure. This commit also reverts all constructed()
functions to use assert again.
2018-02-11 22:23:10 +01:00
4c2df9b365 app: all remaining g_assert() replaced by critical warning and return...
... in app/core.
Continuing on my crusade against asserting and crashing GIMP.
2018-01-22 16:20:04 +01:00
Ell
9eb75cde00 app: use G_FILE_CREATE_NONE for saved internal data files
Use G_FILE_CREATE_NONE, instead of G_FILE_CREATE_REPLACE_DESTINATION,
when saving internal data files, for consistency with the other files
we save.
2017-10-30 07:40:53 -04:00
Ell
e4440e3fdb app: save custom gradient across sessions
Add a framework for saving and restoring internal data objects, in
gimp-internal-data.c.  Internal data objects are saved in separate
files under a new "internal-data" subdirectory of the user's gimp
directory.  The internal data is saved, restored, and cleared
together with the tool options.

Use this to save and restore the custom gradient.  In the future,
we might add similar writable internal data objects that we'd want
to save.
2017-10-29 10:19:07 -04:00