Skip to content

Commit 30e69a3

Browse files
fix: resolve ImGui ID collisions in salvage popup and settings
- In the "Salvage All?" popup, use loop index `i` as PushID instead of `item_id` (cast from uint32_t to int) to guarantee uniqueness. - In the "block_from_being_salvaged" settings list, use a sequential counter instead of the display name string, which could be empty or shared between items before EncString decoding completes. Fixes #2225 Co-authored-by: Marc <henderkes@users.noreply.github.com>
1 parent 2e9e5a6 commit 30e69a3

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

GWToolboxdll/Modules/InventoryManager.cpp

Lines changed: 3 additions & 2 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

@@ -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(static_cast<int>(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)