From 4143054cca30869aefd0c76794a92133f526b1f1 Mon Sep 17 00:00:00 2001 From: Gleb Mazovetskiy Date: Wed, 23 Jul 2025 22:17:13 +0100 Subject: [PATCH] sol2: Use our fork instead of patches --- 3rdParty/sol2/CMakeLists.txt | 34 ++- ...educe-cmake_minimum_required-to-3.22.patch | 56 ----- ...dex-out-of-bounds-in-stack_field.hpp.patch | 35 --- ...end-to-sen-in-usertype_container.hpp.patch | 25 --- ...Lua-Lua-target-when-using-system-Lua.patch | 27 --- ...E_LINK_LIBRARIES-property-for-lualib.patch | 25 --- ...ss_reference_equals-and-stateless_re.patch | 51 ----- ...-Add-Nerixyz-s-test-and-fix-for-C-17.patch | 200 ------------------ ...Faster-track-for-lightuserdata_value.patch | 65 ------ .../sol2/patches/0009-Work-around-1581.patch | 47 ---- 10 files changed, 12 insertions(+), 553 deletions(-) delete mode 100644 3rdParty/sol2/patches/0001-Reduce-cmake_minimum_required-to-3.22.patch delete mode 100644 3rdParty/sol2/patches/0002-Fix-array-index-out-of-bounds-in-stack_field.hpp.patch delete mode 100644 3rdParty/sol2/patches/0003-Change-end-to-sen-in-usertype_container.hpp.patch delete mode 100644 3rdParty/sol2/patches/0004-Fix-missing-Lua-Lua-target-when-using-system-Lua.patch delete mode 100644 3rdParty/sol2/patches/0005-fix-INTERFACE_LINK_LIBRARIES-property-for-lualib.patch delete mode 100644 3rdParty/sol2/patches/0006-Overload-stateless_reference_equals-and-stateless_re.patch delete mode 100644 3rdParty/sol2/patches/0007-Add-Nerixyz-s-test-and-fix-for-C-17.patch delete mode 100644 3rdParty/sol2/patches/0008-Faster-track-for-lightuserdata_value.patch delete mode 100644 3rdParty/sol2/patches/0009-Work-around-1581.patch diff --git a/3rdParty/sol2/CMakeLists.txt b/3rdParty/sol2/CMakeLists.txt index 3b1d42591..4775fdc26 100644 --- a/3rdParty/sol2/CMakeLists.txt +++ b/3rdParty/sol2/CMakeLists.txt @@ -1,33 +1,23 @@ include(functions/FetchContent_ExcludeFromAll_backport) include(FetchContent) -find_package(Patch REQUIRED) - set(SOL2_ENABLE_INSTALL OFF) set(SOL2_BUILD_LUA OFF) set(SOL2_LUA_VERSION "${LUA_VERSION_STRING}") FetchContent_Declare_ExcludeFromAll(sol2 - URL https://github.com/ThePhD/sol2/archive/c1f95a773c6f8f4fde8ca3efe872e7286afe4444.tar.gz - URL_HASH MD5=845ce869733636632d857d8517ac3eb5 - # https://github.com/ThePhD/sol2/pull/1712 - PATCH_COMMAND "${Patch_EXECUTABLE}" -p0 -N < ${CMAKE_CURRENT_LIST_DIR}/patches/0001-Reduce-cmake_minimum_required-to-3.22.patch || true - # https://github.com/ThePhD/sol2/pull/1722 - COMMAND "${Patch_EXECUTABLE}" -p0 -N < ${CMAKE_CURRENT_LIST_DIR}/patches/0002-Fix-array-index-out-of-bounds-in-stack_field.hpp.patch || true - # https://github.com/ThePhD/sol2/pull/1676 - COMMAND "${Patch_EXECUTABLE}" -p0 -N < ${CMAKE_CURRENT_LIST_DIR}/patches/0003-Change-end-to-sen-in-usertype_container.hpp.patch || true - # https://github.com/ThePhD/sol2/pull/1704 - COMMAND "${Patch_EXECUTABLE}" -p0 -N < ${CMAKE_CURRENT_LIST_DIR}/patches/0004-Fix-missing-Lua-Lua-target-when-using-system-Lua.patch || true - # https://github.com/ThePhD/sol2/pull/1705 - COMMAND "${Patch_EXECUTABLE}" -p0 -N < ${CMAKE_CURRENT_LIST_DIR}/patches/0005-fix-INTERFACE_LINK_LIBRARIES-property-for-lualib.patch || true - # https://github.com/ThePhD/sol2/pull/1716 - COMMAND "${Patch_EXECUTABLE}" -p0 -N < ${CMAKE_CURRENT_LIST_DIR}/patches/0006-Overload-stateless_reference_equals-and-stateless_re.patch || true - # https://github.com/ThePhD/sol2/pull/1716 - COMMAND "${Patch_EXECUTABLE}" -p0 -N < ${CMAKE_CURRENT_LIST_DIR}/patches/0007-Add-Nerixyz-s-test-and-fix-for-C-17.patch || true - # https://github.com/ThePhD/sol2/pull/1674 - COMMAND "${Patch_EXECUTABLE}" -p0 -N < ${CMAKE_CURRENT_LIST_DIR}/patches/0008-Faster-track-for-lightuserdata_value.patch || true - # https://github.com/ThePhD/sol2/pull/1722 - COMMAND "${Patch_EXECUTABLE}" -p0 -N < ${CMAKE_CURRENT_LIST_DIR}/patches/0009-Work-around-1581.patch || true + # branch: devilutionx + # This is upstream c1f95a773c6f8f4fde8ca3efe872e7286afe4444 with the following PRs merged on top: + # https://github.com/ThePhD/sol2/pull/1712 + # https://github.com/ThePhD/sol2/pull/1722 + # https://github.com/ThePhD/sol2/pull/1676 + # https://github.com/ThePhD/sol2/pull/1704 + # https://github.com/ThePhD/sol2/pull/1705 + # https://github.com/ThePhD/sol2/pull/1716 + # https://github.com/ThePhD/sol2/pull/1674 + # https://github.com/ThePhD/sol2/pull/1722 + URL https://github.com/diasurgical/sol2/archive/832ac772c2cd3d9620d447e9e77897f7b5e806e3.tar.gz + URL_HASH MD5=06c9c0f3242ee803f50e8fd210fdfe4e ) FetchContent_MakeAvailable_ExcludeFromAll(sol2) diff --git a/3rdParty/sol2/patches/0001-Reduce-cmake_minimum_required-to-3.22.patch b/3rdParty/sol2/patches/0001-Reduce-cmake_minimum_required-to-3.22.patch deleted file mode 100644 index 8c93fd166..000000000 --- a/3rdParty/sol2/patches/0001-Reduce-cmake_minimum_required-to-3.22.patch +++ /dev/null @@ -1,56 +0,0 @@ -From d81d82dbea310f8491ec7a6e2cbcb78516c52b8d Mon Sep 17 00:00:00 2001 -From: Gleb Mazovetskiy -Date: Fri, 4 Jul 2025 18:44:27 +0100 -Subject: [PATCH 1/9] Reduce `cmake_minimum_required` to 3.22 - -Ubuntu 22.04 CMake is 3.22. -Debian stable CMake is 3.25. -Debian oldstable (EOL in 2026) has CMake 3.25 in bullseye-backports. ---- - CMakeLists.txt | 2 +- - documentation/CMakeLists.txt | 2 +- - single/CMakeLists.txt | 2 +- - 3 files changed, 3 insertions(+), 3 deletions(-) - -diff --git CMakeLists.txt CMakeLists.txt -index b54f71a3..507d9be5 100644 ---- CMakeLists.txt -+++ CMakeLists.txt -@@ -22,7 +22,7 @@ - - # # # # sol2 - # # # Required minimum version statement --cmake_minimum_required(VERSION 3.26.0) -+cmake_minimum_required(VERSION 3.22) - # # # Project Include - file that is included after project declaration is finished - set(CMAKE_PROJECT_INCLUDE "${CMAKE_CURRENT_SOURCE_DIR}/cmake/Includes/Project.cmake") - -diff --git documentation/CMakeLists.txt documentation/CMakeLists.txt -index 1c7b6758..ba780c0f 100644 ---- documentation/CMakeLists.txt -+++ documentation/CMakeLists.txt -@@ -22,7 +22,7 @@ - - # # # # sol2, documentation generation - # # # Required minimum version statement --cmake_minimum_required(VERSION 3.26.0) -+cmake_minimum_required(VERSION 3.22) - - find_package(Doxygen REQUIRED) - find_package(Python3 REQUIRED) -diff --git single/CMakeLists.txt single/CMakeLists.txt -index 2d55fe32..a16926de 100644 ---- single/CMakeLists.txt -+++ single/CMakeLists.txt -@@ -22,7 +22,7 @@ - - # # # # sol3, single - # # # Required minimum version statement --cmake_minimum_required(VERSION 3.26.0) -+cmake_minimum_required(VERSION 3.22) - - find_package(Python3 REQUIRED) - --- -2.48.1 - diff --git a/3rdParty/sol2/patches/0002-Fix-array-index-out-of-bounds-in-stack_field.hpp.patch b/3rdParty/sol2/patches/0002-Fix-array-index-out-of-bounds-in-stack_field.hpp.patch deleted file mode 100644 index e79cdafd7..000000000 --- a/3rdParty/sol2/patches/0002-Fix-array-index-out-of-bounds-in-stack_field.hpp.patch +++ /dev/null @@ -1,35 +0,0 @@ -From 24241c564783a8dc9bca24aac69e0fb9cee76949 Mon Sep 17 00:00:00 2001 -From: martin nylin -Date: Tue, 11 Mar 2025 21:28:44 +0100 -Subject: [PATCH 2/9] Fix array index out of bounds in stack_field.hpp - ---- - include/sol/stack_field.hpp | 12 +++++++++++- - 1 file changed, 11 insertions(+), 1 deletion(-) - -diff --git include/sol/stack_field.hpp include/sol/stack_field.hpp -index 9dd66e2e..3b815225 100644 ---- include/sol/stack_field.hpp -+++ include/sol/stack_field.hpp -@@ -113,7 +113,17 @@ namespace sol { namespace stack { - lua_getglobal(L, &key[0]); - } - else { -- lua_getfield(L, tableindex, &key[0]); -+ if constexpr (std::is_same_v, const char*>) { -+ // Handle const char* case -+ if (key != nullptr) { -+ lua_getfield(L, tableindex, key); -+ } else { -+ push(L, lua_nil); -+ } -+ } else { -+ // Handle std::string case -+ lua_getfield(L, tableindex, key.c_str()); -+ } - } - } - else if constexpr (std::is_same_v) { --- -2.48.1 - diff --git a/3rdParty/sol2/patches/0003-Change-end-to-sen-in-usertype_container.hpp.patch b/3rdParty/sol2/patches/0003-Change-end-to-sen-in-usertype_container.hpp.patch deleted file mode 100644 index 79b6884f2..000000000 --- a/3rdParty/sol2/patches/0003-Change-end-to-sen-in-usertype_container.hpp.patch +++ /dev/null @@ -1,25 +0,0 @@ -From 12a596d1b592acccd0ddee7df3b4e33f25550ff8 Mon Sep 17 00:00:00 2001 -From: martin nylin -Date: Tue, 11 Mar 2025 20:58:43 +0100 -Subject: [PATCH 3/9] Change end() to sen() in usertype_container.hpp - ---- - include/sol/usertype_container.hpp | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git include/sol/usertype_container.hpp include/sol/usertype_container.hpp -index 6d25d2a8..3ff81724 100644 ---- include/sol/usertype_container.hpp -+++ include/sol/usertype_container.hpp -@@ -1189,7 +1189,7 @@ namespace sol { - static int next_associative(std::true_type, lua_State* L_) { - iter& i = stack::unqualified_get>(L_, 1); - auto& it = i.it(); -- auto& end = i.end(); -+ auto& end = i.sen(); - if (it == end) { - return stack::push(L_, lua_nil); - } --- -2.48.1 - diff --git a/3rdParty/sol2/patches/0004-Fix-missing-Lua-Lua-target-when-using-system-Lua.patch b/3rdParty/sol2/patches/0004-Fix-missing-Lua-Lua-target-when-using-system-Lua.patch deleted file mode 100644 index a43079b5a..000000000 --- a/3rdParty/sol2/patches/0004-Fix-missing-Lua-Lua-target-when-using-system-Lua.patch +++ /dev/null @@ -1,27 +0,0 @@ -From c5496869eab66dbf2ee1cb6d7f10536da809ace0 Mon Sep 17 00:00:00 2001 -From: syzygial <67280346+syzygial@users.noreply.github.com> -Date: Sat, 31 May 2025 22:38:52 -0400 -Subject: [PATCH 4/9] Fix missing Lua::Lua target when using system Lua - ---- - CMakeLists.txt | 4 ++++ - 1 file changed, 4 insertions(+) - -diff --git CMakeLists.txt CMakeLists.txt -index 507d9be5..ed1a6b59 100644 ---- CMakeLists.txt -+++ CMakeLists.txt -@@ -276,6 +276,10 @@ if (sol2-is-top-level-project) - set(LUA_LIBRARIES ${lualib}) - endif() - -+ if(NOT TARGET Lua::Lua) -+ add_library(Lua::Lua ALIAS ${lualib}) -+ endif() -+ - if (NOT LUA_FOUND AND NOT LUABUILD_FOUND) - message(FATAL_ERROR "sol2 Lua \"${SOL2_LUA_VERSION}\" not found and could not be targeted for building") - endif() --- -2.48.1 - diff --git a/3rdParty/sol2/patches/0005-fix-INTERFACE_LINK_LIBRARIES-property-for-lualib.patch b/3rdParty/sol2/patches/0005-fix-INTERFACE_LINK_LIBRARIES-property-for-lualib.patch deleted file mode 100644 index 4412a66f2..000000000 --- a/3rdParty/sol2/patches/0005-fix-INTERFACE_LINK_LIBRARIES-property-for-lualib.patch +++ /dev/null @@ -1,25 +0,0 @@ -From f433abdad78bf7601563674f292ac4c96b042220 Mon Sep 17 00:00:00 2001 -From: syzygial <67280346+syzygial@users.noreply.github.com> -Date: Sat, 31 May 2025 12:04:26 -0400 -Subject: [PATCH 5/9] fix INTERFACE_LINK_LIBRARIES property for lualib - ---- - CMakeLists.txt | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git CMakeLists.txt CMakeLists.txt -index ed1a6b59..1e2edf9a 100644 ---- CMakeLists.txt -+++ CMakeLists.txt -@@ -270,7 +270,7 @@ if (sol2-is-top-level-project) - set_target_properties(${lualib} - PROPERTIES - INTERFACE_INCLUDE_DIRECTORIES ${LUA_INCLUDE_DIR} -- INTERFACE_LINK_LIBRARIES "${LUA_SEARCH_DEPENDENCY_LIBS} ${CMAKE_DL_LIBS}" -+ INTERFACE_LINK_LIBRARIES "${LUA_SEARCH_DEPENDENCY_LIBS};${CMAKE_DL_LIBS}" - IMPORTED_LINK_INTERFACE_LANGUAGES C - IMPORTED_LOCATION ${lualiblocation}) - set(LUA_LIBRARIES ${lualib}) --- -2.48.1 - diff --git a/3rdParty/sol2/patches/0006-Overload-stateless_reference_equals-and-stateless_re.patch b/3rdParty/sol2/patches/0006-Overload-stateless_reference_equals-and-stateless_re.patch deleted file mode 100644 index f1542feff..000000000 --- a/3rdParty/sol2/patches/0006-Overload-stateless_reference_equals-and-stateless_re.patch +++ /dev/null @@ -1,51 +0,0 @@ -From ee5af5e0564d1dad7d37e9849404b5be0849142f Mon Sep 17 00:00:00 2001 -From: Evil Eye -Date: Thu, 10 Jul 2025 17:53:18 +0200 -Subject: [PATCH 6/9] Overload stateless_reference_equals and - stateless_reference_hash to prevent implicit conversion of stack_reference to - stateless_reference - ---- - include/sol/reference.hpp | 12 ++++++++++++ - 1 file changed, 12 insertions(+) - -diff --git include/sol/reference.hpp include/sol/reference.hpp -index c7781552..e7be661a 100644 ---- include/sol/reference.hpp -+++ include/sol/reference.hpp -@@ -828,6 +828,8 @@ namespace sol { - stateless_reference_equals(lua_State* L_) noexcept : stateless_stack_reference_equals(L_) { - } - -+ using stateless_stack_reference_equals::operator(); -+ - bool operator()(const lua_nil_t& lhs, const stateless_reference& rhs) const noexcept { - return rhs.equals(lua_state(), lhs); - } -@@ -839,6 +841,14 @@ namespace sol { - bool operator()(const stateless_reference& lhs, const stateless_reference& rhs) const noexcept { - return lhs.equals(lua_state(), rhs); - } -+ -+ bool operator()(const stateless_stack_reference& lhs, const stateless_reference& rhs) const noexcept { -+ return rhs.equals(lua_state(), lhs); -+ } -+ -+ bool operator()(const stateless_reference& lhs, const stateless_stack_reference& rhs) const noexcept { -+ return lhs.equals(lua_state(), rhs); -+ } - }; - - struct reference_equals : public stack_reference_equals { -@@ -878,6 +888,8 @@ namespace sol { - stateless_reference_hash(lua_State* L_) noexcept : stateless_stack_reference_hash(L_) { - } - -+ using stateless_stack_reference_hash::operator(); -+ - result_type operator()(const stateless_reference& lhs) const noexcept { - std::hash h; - return h(lhs.pointer(lua_state())); --- -2.48.1 - diff --git a/3rdParty/sol2/patches/0007-Add-Nerixyz-s-test-and-fix-for-C-17.patch b/3rdParty/sol2/patches/0007-Add-Nerixyz-s-test-and-fix-for-C-17.patch deleted file mode 100644 index 69d232a9a..000000000 --- a/3rdParty/sol2/patches/0007-Add-Nerixyz-s-test-and-fix-for-C-17.patch +++ /dev/null @@ -1,200 +0,0 @@ -From 6ec30440f64de88a2ac1e909532c99ae0c3ee61f Mon Sep 17 00:00:00 2001 -From: Evil Eye -Date: Sat, 12 Jul 2025 15:33:54 +0200 -Subject: [PATCH 7/9] Add Nerixyz's test and fix for C++17 - ---- - include/sol/usertype_storage.hpp | 4 ++ - tests/regression_tests/1716/CMakeLists.txt | 45 ++++++++++++++ - .../source/1716 - registry indexing leak.cpp | 61 +++++++++++++++++++ - tests/regression_tests/1716/source/main.cpp | 31 ++++++++++ - tests/regression_tests/CMakeLists.txt | 1 + - 5 files changed, 142 insertions(+) - create mode 100644 tests/regression_tests/1716/CMakeLists.txt - create mode 100644 tests/regression_tests/1716/source/1716 - registry indexing leak.cpp - create mode 100644 tests/regression_tests/1716/source/main.cpp - -diff --git include/sol/usertype_storage.hpp include/sol/usertype_storage.hpp -index bdca6146..691a025b 100644 ---- include/sol/usertype_storage.hpp -+++ include/sol/usertype_storage.hpp -@@ -502,7 +502,11 @@ namespace sol { namespace u_detail { - stateless_reference* target = nullptr; - { - stack_reference k = stack::get(L, 2); -+#if __cpp_lib_generic_unordered_lookup >= 201811L - auto it = self.auxiliary_keys.find(k); -+#else -+ auto it = self.auxiliary_keys.find(basic_reference(k)); -+#endif - if (it != self.auxiliary_keys.cend()) { - target = &it->second; - } -diff --git tests/regression_tests/1716/CMakeLists.txt tests/regression_tests/1716/CMakeLists.txt -new file mode 100644 -index 00000000..33ca975c ---- /dev/null -+++ tests/regression_tests/1716/CMakeLists.txt -@@ -0,0 +1,45 @@ -+# # # # sol2 -+# The MIT License (MIT) -+# -+# Copyright (c) 2013-2022 Rapptz, ThePhD, and contributors -+# -+# Permission is hereby granted, free of charge, to any person obtaining a copy of -+# this software and associated documentation files (the "Software"), to deal in -+# the Software without restriction, including without limitation the rights to -+# use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of -+# the Software, and to permit persons to whom the Software is furnished to do so, -+# subject to the following conditions: -+# -+# The above copyright notice and this permission notice shall be included in all -+# copies or substantial portions of the Software. -+# -+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS -+# FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR -+# COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER -+# IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -+# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -+ -+# # # # sol2 tests - simple regression tests -+ -+file(GLOB_RECURSE sources -+ LIST_DIRECTORIES FALSE -+ CONFIG_DEPENDS source/*.cpp) -+ -+sol2_create_basic_test(sol2.tests.regression_1716 sol2::sol2 ${sources}) -+sol2_create_basic_test(sol2.tests.regression_1716.SOL_ALL_SAFETIES_ON sol2::sol2 ${sources}) -+target_compile_options(sol2.tests.regression_1716 -+ PRIVATE -+ ${--allow-unreachable-code}) -+target_compile_definitions(sol2.tests.regression_1716.SOL_ALL_SAFETIES_ON -+ PRIVATE -+ SOL_ALL_SAFETIES_ON=1) -+target_compile_options(sol2.tests.regression_1716.SOL_ALL_SAFETIES_ON -+ PRIVATE -+ ${--allow-unreachable-code}) -+if (SOL2_TESTS_SINGLE) -+ sol2_create_basic_test(sol2.single.tests.regression_1716 sol2::sol2::single ${sources}) -+ target_compile_options(sol2.single.tests.regression_1716 -+ PRIVATE -+ ${--allow-unreachable-code}) -+endif() -diff --git tests/regression_tests/1716/source/1716 - registry indexing leak.cpp tests/regression_tests/1716/source/1716 - registry indexing leak.cpp -new file mode 100644 -index 00000000..9bc263f6 ---- /dev/null -+++ tests/regression_tests/1716/source/1716 - registry indexing leak.cpp -@@ -0,0 +1,61 @@ -+// sol2 -+ -+// The MIT License (MIT) -+ -+// Copyright (c) 2013-2022 Rapptz, ThePhD and contributors -+ -+// Permission is hereby granted, free of charge, to any person obtaining a copy of -+// this software and associated documentation files (the "Software"), to deal in -+// the Software without restriction, including without limitation the rights to -+// use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of -+// the Software, and to permit persons to whom the Software is furnished to do so, -+// subject to the following conditions: -+ -+// The above copyright notice and this permission notice shall be included in all -+// copies or substantial portions of the Software. -+ -+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS -+// FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR -+// COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER -+// IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -+// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -+ -+#include -+ -+#include -+ -+TEST_CASE("#1716 - index and newindex should not leak values into the registry", "[sol2][regression][issue1716]") { -+ class vector { -+ public: -+ vector() = default; -+ -+ static int my_index(vector&, int) { -+ return 0; -+ } -+ -+ static void my_new_index(vector&, int, int) { -+ return; -+ } -+ }; -+ -+ sol::state lua; -+ lua.open_libraries(sol::lib::base); -+ lua.new_usertype("vector", -+ sol::constructors>(), // -+ sol::meta_function::index, -+ &vector::my_index, // -+ sol::meta_function::new_index, -+ &vector::my_new_index); -+ auto begin = lua.registry().size(); -+ lua.script(R"( -+ local v = vector.new() -+ local unused = 0 -+ for i=1,100 do -+ unused = v[1] -+ v[1] = 1 -+ end -+ )"); -+ -+ REQUIRE(lua.registry().size() <= begin + 1); -+} -diff --git tests/regression_tests/1716/source/main.cpp tests/regression_tests/1716/source/main.cpp -new file mode 100644 -index 00000000..43e1e320 ---- /dev/null -+++ tests/regression_tests/1716/source/main.cpp -@@ -0,0 +1,31 @@ -+// sol2 -+ -+// The MIT License (MIT) -+ -+// Copyright (c) 2013-2022 Rapptz, ThePhD and contributors -+ -+// Permission is hereby granted, free of charge, to any person obtaining a copy of -+// this software and associated documentation files (the "Software"), to deal in -+// the Software without restriction, including without limitation the rights to -+// use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of -+// the Software, and to permit persons to whom the Software is furnished to do so, -+// subject to the following conditions: -+ -+// The above copyright notice and this permission notice shall be included in all -+// copies or substantial portions of the Software. -+ -+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS -+// FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR -+// COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER -+// IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -+// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -+ -+#define CATCH_CONFIG_RUNNER -+ -+#include -+ -+int main(int argc, char* argv[]) { -+ int result = Catch::Session().run(argc, argv); -+ return result; -+} -diff --git tests/regression_tests/CMakeLists.txt tests/regression_tests/CMakeLists.txt -index 7af8ed61..31400503 100644 ---- tests/regression_tests/CMakeLists.txt -+++ tests/regression_tests/CMakeLists.txt -@@ -23,4 +23,5 @@ - # # # # sol2 tests - - add_subdirectory(1011) -+add_subdirectory(1716) - add_subdirectory(simple) --- -2.48.1 - diff --git a/3rdParty/sol2/patches/0008-Faster-track-for-lightuserdata_value.patch b/3rdParty/sol2/patches/0008-Faster-track-for-lightuserdata_value.patch deleted file mode 100644 index 4c5bc339c..000000000 --- a/3rdParty/sol2/patches/0008-Faster-track-for-lightuserdata_value.patch +++ /dev/null @@ -1,65 +0,0 @@ -From f0d0ef4007c64a5a91146d834375a1684d27241c Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Pawe=C5=82=20Per=C5=82akowski?= -Date: Tue, 25 Feb 2025 17:39:39 +0100 -Subject: [PATCH 8/9] Faster track for lightuserdata_value - ---- - include/sol/stack_check_qualified.hpp | 2 +- - include/sol/stack_check_unqualified.hpp | 4 +--- - include/sol/stack_core.hpp | 5 ++--- - 3 files changed, 4 insertions(+), 7 deletions(-) - -diff --git include/sol/stack_check_qualified.hpp include/sol/stack_check_qualified.hpp -index cc2394af..3ce5b642 100644 ---- include/sol/stack_check_qualified.hpp -+++ include/sol/stack_check_qualified.hpp -@@ -28,7 +28,7 @@ - - namespace sol { namespace stack { - -- template -+ template - struct qualified_checker { - template - static bool check(lua_State* L, int index, Handler&& handler, record& tracking) { -diff --git include/sol/stack_check_unqualified.hpp include/sol/stack_check_unqualified.hpp -index d75557c4..18974987 100644 ---- include/sol/stack_check_unqualified.hpp -+++ include/sol/stack_check_unqualified.hpp -@@ -389,9 +389,7 @@ namespace sol { namespace stack { - return success; - } - else if constexpr (meta::is_specialization_of_v) { -- unqualified_checker c; -- (void)c; -- return c.check(L_, index, std::forward(handler), tracking); -+ return stack::unqualified_check>(L_, index, std::forward(handler), tracking); - } - else { - if constexpr (std::is_pointer_v) { -diff --git include/sol/stack_core.hpp include/sol/stack_core.hpp -index c4f5e203..2ce3ca2b 100644 ---- include/sol/stack_core.hpp -+++ include/sol/stack_core.hpp -@@ -571,7 +571,7 @@ namespace sol { - - template - struct unqualified_checker; -- template -+ template - struct qualified_checker; - - template -@@ -1002,8 +1002,7 @@ namespace sol { - return sol_lua_check(types(), L, index, std::forward(handler), tracking); - } - else { -- using Tu = meta::unqualified_t; -- qualified_checker> c{}; -+ qualified_checker c{}; - return c.check(L, index, std::forward(handler), tracking); - } - } --- -2.48.1 - diff --git a/3rdParty/sol2/patches/0009-Work-around-1581.patch b/3rdParty/sol2/patches/0009-Work-around-1581.patch deleted file mode 100644 index 328535588..000000000 --- a/3rdParty/sol2/patches/0009-Work-around-1581.patch +++ /dev/null @@ -1,47 +0,0 @@ -From 56cef1c15fb6f5b78e5debcb62d8ac914a0f007c Mon Sep 17 00:00:00 2001 -From: Gleb Mazovetskiy -Date: Sun, 20 Jul 2025 09:03:08 +0100 -Subject: [PATCH 9/9] Work around #1581 - -See https://github.com/ThePhD/sol2/issues/1581#issuecomment-2103463524 ---- - include/sol/function_types_stateless.hpp | 16 ++++++++++++++-- - 1 file changed, 14 insertions(+), 2 deletions(-) - -diff --git include/sol/function_types_stateless.hpp include/sol/function_types_stateless.hpp -index a2f66ba0..fe0f3f0b 100644 ---- include/sol/function_types_stateless.hpp -+++ include/sol/function_types_stateless.hpp -@@ -320,7 +320,13 @@ namespace sol { namespace function_detail { - } - - template -- static int call(lua_State* L) noexcept(std::is_nothrow_copy_assignable_v) { -+ static int call(lua_State* L) -+#if SOL_IS_ON(SOL_COMPILER_CLANG) -+ // apparent regression in clang 18 - llvm/llvm-project#91362 -+#else -+ noexcept(std::is_nothrow_copy_assignable_v) -+#endif -+ { - int nr; - if constexpr (no_trampoline) { - nr = real_call(L); -@@ -360,7 +366,13 @@ namespace sol { namespace function_detail { - } - - template -- static int call(lua_State* L) noexcept(std::is_nothrow_copy_assignable_v) { -+ static int call(lua_State* L) -+#if SOL_IS_ON(SOL_COMPILER_CLANG) -+ // apparent regression in clang 18 - llvm/llvm-project#91362 -+#else -+ noexcept(std::is_nothrow_copy_assignable_v) -+#endif -+ { - int nr; - if constexpr (no_trampoline) { - nr = real_call(L); --- -2.48.1 -