Skip to content

Commit 6f189e7

Browse files
authored
Merge pull request #2226 from gwdevhub/claude/issue-2225-20260609-0246
fix: resolve ImGui ID collisions in salvage popup
2 parents 2e9e5a6 + c4a76a7 commit 6f189e7

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

GWToolboxdll/Modules/InventoryManager.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1342,8 +1342,9 @@ namespace {
13421342
ImGui::BeginChild("block_from_being_salvaged", ImVec2(0.0F, list_height));
13431343

13441344
const float wrap_width2 = ImGui::GetContentRegionAvail().x;
1345+
int salvage_block_idx = 0;
13451346
for (const auto& it : block_from_being_salvaged) {
1346-
ImGui::PushID(it.second.c_str());
1347+
ImGui::PushID(salvage_block_idx++);
13471348

13481349
const auto button_label = std::format("{} | X", it.second);
13491350

@@ -2242,7 +2243,7 @@ void InventoryManager::Draw(IDirect3DDevice9*)
22422243
potential_salvage_all_items[i]->proceed = check_all_items;
22432244
}
22442245
}
2245-
for (size_t i = 0; i < potential_salvage_all_items.size(); i++) {
2246+
for (int i = 0; i < static_cast<int>(potential_salvage_all_items.size()); i++) {
22462247
PotentialItem* pi = potential_salvage_all_items[i];
22472248
if (!pi) {
22482249
continue;
@@ -2272,7 +2273,7 @@ void InventoryManager::Draw(IDirect3DDevice9*)
22722273
ImGui::PushStyleColor(ImGuiCol_Text, ImGui::GetStyleColorVec4(ImGuiCol_Text));
22732274
break;
22742275
}
2275-
ImGui::PushID(static_cast<int>(pi->item_id));
2276+
ImGui::PushID(i);
22762277
ImGui::Checkbox(pi->name->string().c_str(), &pi->proceed);
22772278
const float item_name_length = ImGui::CalcTextSize(pi->name->string().c_str(), nullptr, true).x;
22782279
longest_item_name_length = item_name_length > longest_item_name_length ? item_name_length : longest_item_name_length;

0 commit comments

Comments
 (0)