From: <sv...@op...> - 2024-12-12 21:15:49
|
Author: sagamusix Date: Thu Dec 12 22:15:42 2024 New Revision: 22527 URL: https://source.openmpt.org/browse/openmpt/?op=revision&rev=22527 Log: [Ref] Quick Start Dialog: Optimize memory usage. Modified: trunk/OpenMPT/mptrack/QuickStartDialog.cpp Modified: trunk/OpenMPT/mptrack/QuickStartDialog.cpp ============================================================================== --- trunk/OpenMPT/mptrack/QuickStartDialog.cpp Thu Dec 12 22:14:57 2024 (r22526) +++ trunk/OpenMPT/mptrack/QuickStartDialog.cpp Thu Dec 12 22:15:42 2024 (r22527) @@ -120,6 +120,7 @@ if(m_prevDPI) { // We don't use this as a stand-alone dialog but rather embed it in the MDI child area, and it is not resized automatically. + MPT_ASSERT(GetStyle() & WS_CHILD); CRect windowRect; GetClientRect(windowRect); windowRect.right = Util::muldiv(windowRect.right, GetDPI(), m_prevDPI); @@ -312,10 +313,9 @@ { struct OpenItem { - const mpt::PathString path; // Must create copy because dialog will get destroyed after successfully loading the first file - const int item; - const int group; - const size_t index; + mpt::PathString path; // Must create copy because dialog will get destroyed after successfully loading the first file + int item = 0; + int group = 0; }; std::vector<OpenItem> files; int i = -1; @@ -323,8 +323,7 @@ { const int group = GetItemGroup(i); const size_t index = GetItemIndex(i); - const auto &path = m_paths[group][index]; - files.push_back({path, i, group, index}); + files.push_back({std::move(m_paths[group][index]), i, group}); } bool success = false; for(const auto &item : files) @@ -340,7 +339,6 @@ // If at least one item managed to load, the dialog will now be destroyed, and there are no items to delete from the list for(auto it = files.rbegin(); it != files.rend(); it++) { - m_paths[it->group][it->index] = {}; m_list.DeleteItem(it->item); } } |