thezbyg / gpick

Advanced color picker written in C++ using GTK+ toolkit
BSD 3-Clause "New" or "Revised" License
376 stars 33 forks source link

Gpick crashes when trying to open a certain save file #193

Closed DanielFlaum closed 2 years ago

DanielFlaum commented 3 years ago

I recently upgraded from Fedora Workstation 33 with Gpick 0.2.6rc1 to Fedora Workstation 34 with Gpick 0.2.6, and found that Gpick could no longer open a .gpa file of mine. It would crash, with this error appearing on output:

/usr/include/c++/11/bits/basic_string.h:1101: std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::reference std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::front() [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::reference = char&]: Assertion '!empty()' failed.

The file is attached. I verified that it could still be opened on Fedora 33. Note that it does contain colors which have empty names. This may have something to do with it.

solarized-expanded.zip

thezbyg commented 3 years ago

Hi, looks like Fedora builds with extra error checking enabled by defining_GLIBCXX_ASSERTIONS. This results in assertion failure on empty string access. Should be fixed as of 0e858d33fd28d98d2689d0ebb92c975729a9f7bc.

Empty string access happens only when palette file contains empty color name, so you could use older version to name all colors and work-around this issue while waiting for distribution package update.