Skip to content

Commit db26f68

Browse files
committed
* CC: Fix assert for invalid colour (ticket #1085, thanks Miguel Gimenez)
> The tree can take an invalid colour, interpreting it as "Default colour". > The original problem happened because we take m_colour RGB components to calculate the CRC, and that can't be done in an uninitialized colour. > Just adding the validity check in CRC calculation is enough. > Adding an initialization just in case. Hopefully it doesn't slow things down too much. git-svn-id: https://svn.code.sf.net/p/codeblocks/code/trunk@12322 2a5c6006-c6dd-42ca-98ab-0921f2732cef
1 parent c57446d commit db26f68

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

src/plugins/codecompletion/classbrowserbuilderthread.cpp

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1167,6 +1167,7 @@ CCTreeItem::CCTreeItem(CCTreeItem* parent, const wxString& text, int image, int
11671167
m_data(data),
11681168
m_bold(false),
11691169
m_hasChildren(false),
1170+
m_colour(wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOWTEXT)),
11701171
m_semaphore(0, 1)
11711172
{
11721173
m_image[wxTreeItemIcon_Normal] = image;
@@ -1451,9 +1452,13 @@ void CCTree::CalculateCrc32(CCTreeItem* parent, Crc32 &crc) const
14511452
crc.Update(child->m_text.data(), child->m_text.size());
14521453
crc.Update(child->m_bold ? 1 : 0);
14531454
crc.Update(child->m_hasChildren ? 1 : 0);
1454-
crc.Update(child->m_colour.Red());
1455-
crc.Update(child->m_colour.Green());
1456-
crc.Update(child->m_colour.Blue());
1455+
if (child->m_colour.IsOk())
1456+
{
1457+
crc.Update(child->m_colour.Red());
1458+
crc.Update(child->m_colour.Green());
1459+
crc.Update(child->m_colour.Blue());
1460+
}
1461+
14571462
crc.Update(child->m_image, sizeof(child->m_image));
14581463
// Compare only token name
14591464
if (child->m_data)

0 commit comments

Comments
 (0)