Skip to content

Commit c5d0601

Browse files
ellertAxel-Naumann
authored andcommitted
Avoid crashes due to static initialization order
Most commonly seen on ppc64le. Backtrace: =========================================================== The lines below might hint at the cause of the crash. You may get help by asking at the ROOT forum https://root.cern/forum Only if you are really convinced it is a bug in ROOT then please submit a report at https://root.cern/bugs Please post the ENTIRE stack trace from above as an attachment in addition to anything else that might help us fixing this issue. =========================================================== #11 ROOT::Experimental::RColor::toHex[abi:cxx11](unsigned char) (v=<optimized out>) at /usr/include/c++/11/ext/new_allocator.h:82 #12 0x00007fff90c220ec in ROOT::Experimental::RColor::SetRGB (this=0x7fffeadf5d10, r=<optimized out>, g=<optimized out>, b=<optimized out>) at /usr/include/c++/11/ext/new_allocator.h:89
1 parent 4ecb41a commit c5d0601

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

graf2d/gpadv7/src/RColor.cxx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -232,10 +232,10 @@ std::vector<uint8_t> RColor::AsRGBA() const
232232

233233
std::string RColor::toHex(uint8_t v)
234234
{
235-
static const char *digits = "0123456789ABCDEF";
235+
auto digits = [](auto d) { return d < 10 ? '0' + d : 'A' - 10 + d; };
236236
std::string res(2,'0');
237-
res[0] = digits[v >> 4];
238-
res[1] = digits[v & 0xf];
237+
res[0] = digits(v >> 4);
238+
res[1] = digits(v & 0xf);
239239
return res;
240240
}
241241

0 commit comments

Comments
 (0)