From 7e2c734a9a8a03d56e2d821afa3fcebd940a3e28 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20S=C3=BC=C3=9Fenbach?= Date: Mon, 5 Mar 2018 10:38:47 +0100 Subject: [PATCH] Fix ObjectDeleter arguments for NoParent cases. (#192) --- VulkanHppGenerator.cpp | 3 ++- vulkan/vulkan.hpp | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/VulkanHppGenerator.cpp b/VulkanHppGenerator.cpp index 93109f6..3dffa1d 100644 --- a/VulkanHppGenerator.cpp +++ b/VulkanHppGenerator.cpp @@ -3509,8 +3509,9 @@ void VulkanHppGenerator::writeFunctionBodyEnhancedReturnResultValue(std::ostream assert(ddit != m_deleters.end() && ddit->second.pool.empty()); // special handling for "createDevice", as Device is created from PhysicalDevice, but destroyed on its own + bool noParent = commandData.className.empty() || (commandData.fullName == "createDevice"); os << std::endl - << indentation << ((commandData.fullName == "allocateMemory") ? " ObjectFree<" : " ObjectDestroy<") << ((commandData.className.empty() || (commandData.fullName == "createDevice")) ? "NoParent" : commandData.className) << "> deleter( " << (commandData.className.empty() ? "" : "*this, ") << "allocator );" << std::endl; + << indentation << ((commandData.fullName == "allocateMemory") ? " ObjectFree<" : " ObjectDestroy<") << (noParent ? "NoParent" : commandData.className) << "> deleter( " << (noParent ? "" : "*this, ") << "allocator );" << std::endl; } // if the return type is "Result" or there is at least one success code, create the Result/Value construct to return diff --git a/vulkan/vulkan.hpp b/vulkan/vulkan.hpp index d80560d..65e12c7 100644 --- a/vulkan/vulkan.hpp +++ b/vulkan/vulkan.hpp @@ -33079,7 +33079,7 @@ public: Device device; Result result = static_cast( d.vkCreateDevice( m_physicalDevice, reinterpret_cast( &createInfo ), reinterpret_cast( static_cast( allocator ) ), reinterpret_cast( &device ) ) ); - ObjectDestroy deleter( *this, allocator ); + ObjectDestroy deleter( allocator ); return createResultValue( result, device, VULKAN_HPP_NAMESPACE_STRING"::PhysicalDevice::createDeviceUnique", deleter ); } #endif /*VULKAN_HPP_NO_SMART_HANDLE*/