Closed mineo closed 5 years ago
Great catch; and thank you very much for the patch!
I wonder if there's a way to do this automatically, e.g. whenever someone creates a Metadata
for the first time... but that can be an enhancement for another time!
If you'd like to, you should feel free to add yourself to the CONTRIBUTORS.md
file, or I can go ahead and merge this as-is and add you myself if you'd prefer?
Thanks again for the contribution!
I've added myself to CONTRIBUTORS.md
I wasn't sure about the costs of moving the initialization into Metadata
s various constructors, since I assume there's at least some sort of synchronization going on with std::sync::Once
, which might add up for a large amount of calls.
Thank you again for this improvement! Merged!
Hey; just wanted to mention that I've just published a new version that includes this: https://github.com/felixc/rexiv2/releases/tag/v0.7.0
gexiv2_initialize is required to be called in multi-threaded applications, because otherwise the program might crash with multiple threads having stack traces ending in:
This calls https://felixcrux.com/files/doc/gexiv2_sys/fn.gexiv2_initialize.html, which in turn calls https://gitlab.gnome.org/GNOME/gexiv2/blob/bde3a816807ad998f80127b8df0263b036fdc732/gexiv2/gexiv2-startup.h#L23-33, which calls http://www.exiv2.org/doc/classExiv2_1_1XmpParser.html#aea661a7039adb5a748eb7639c8ce9294, which mentions in its documentation:
Calling this method is usually not needed, as encode() and decode() will initialize the XMP Toolkit if necessary.