Skip to content

Commit a524f06

Browse files
committed
Added extra check for duplicate groupids when creating new groups on Vista/Win7+
1 parent c08b018 commit a524f06

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

CGridListCtrlEx/CGridListCtrlGroups.cpp

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,18 @@ LRESULT CGridListCtrlGroups::InsertGroupHeader(int nIndex, int nGroupId, const C
7272
lg.cchHeader = (int)header.Length();
7373
#endif
7474

75+
#ifdef _DEBUG
76+
if (IsGroupStateEnabled())
77+
{
78+
// Extra check as Vista/Win7+ doesn't complain about inserting the same groupid twice
79+
CSimpleArray<int> groupIds;
80+
if (GetGroupIds(groupIds))
81+
{
82+
for(int i = 0 ; i < groupIds.GetSize(); ++i)
83+
VERIFY( groupIds[i] != nGroupId );
84+
}
85+
}
86+
#endif
7587
return InsertGroup(nIndex, (PLVGROUP)&lg );
7688
}
7789

0 commit comments

Comments
 (0)