CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Oct 2017
    Posts
    50

    [RESOLVED] Unhandled exception at TextShaping.dll when throwing an an exeption

    I got Unhandled exception at 0x00007FFB80B9DFA4 (TextShaping.dll) in CubeHLSL.exe: 0xC00000FD: Stack overflow (parameters: 0x0000000000000001, 0x00000055C9473FC8).
    Name:  Untitled.jpg
Views: 422
Size:  8.7 KB

    The void Vulkan::MouseCallback(DOUBLE positionX, DOUBLE positionY) is a pure virtual function and it's implemented at void CubeHLSLA::MouseCallback(DOUBLE positionX, DOUBLE positionY) below
    Code:
    void CubeHLSLApp::MouseCallback(DOUBLE positionX, DOUBLE positionY)
    {
    
    }
    Here's the exeption class
    Code:
    class Exeption
    {
    public:
    	virtual std::string ToString() const = 0;
    };
    
    class GeneralExeption : public Exeption
    {
    private:
    	std::string mMessage;
    
    public:
    	GeneralExeption(const std::string& message);
    	std::string ToString() const override;
    };
    
    class VulkanExeption : public Exeption
    {
    private:
    	VkResult mResult = VK_SUCCESS;
    	std::string mFunctionName;
    	std::string mFilename;
    	INT32 mLineNumber = -1;
    
    public:
    	VulkanExeption() = default;
    	VulkanExeption(VkResult result, const std::string& functionName, const std::string& filename, INT32 lineNumber);
    	std::string ToString() const override;
    };
    
    
    GeneralExeption::GeneralExeption(const std::string& message) :
        mMessage(message)
    {
    }
    
    std::string GeneralExeption::ToString() const
    {
        return mMessage;
    }
    
    VulkanExeption::VulkanExeption(VkResult result, const std::string& functionName, const std::string& filename, INT32 lineNumber) :
        mResult(result),
        mFunctionName(functionName),
        mFilename(filename),
        mLineNumber(lineNumber)
    {
    
    }
    
    std::string VulkanExeption::ToString() const
    {
        std::string stringVkResult = string_VkResult(mResult);
        return mFunctionName + " failed in " + mFilename + "; line " + std::to_string(mLineNumber) + "; error: " + stringVkResult;
    }
    Here's where the exeption thrown
    Code:
    VkShaderModule VulkanUtil::CreateShaderModule(VkDevice device, const std::string& filename)
    {
        std::ifstream file(filename, std::ios_base::binary);
    
        if (file.is_open() == false)
            throw GeneralExeption(std::string("Failed to open ") + filename);
    
        file.seekg(0, std::ios_base::end);
        UINT64 byteSize = file.tellg();
        file.seekg(0, std::ios_base::beg);
    
        char* fileData = new char[byteSize];
        file.read(fileData, byteSize);
        file.close();
    
        VkShaderModuleCreateInfo shaderModuleCreateInfo = {};
        shaderModuleCreateInfo.sType = VK_STRUCTURE_TYPE_SHADER_MODULE_CREATE_INFO;
        shaderModuleCreateInfo.codeSize = byteSize;
        shaderModuleCreateInfo.pCode = reinterpret_cast<UINT*>(fileData);
    
        VkShaderModule shader;
        ThrowIfFailed(vkCreateShaderModule(device, &shaderModuleCreateInfo, nullptr, &shader));
        delete[] fileData;
    
        return shader;
    }
    Here's where the weird things, when i put a breakpoint somewhere before exeption is thrown it works as desired
    Name:  Untitled1.jpg
Views: 612
Size:  23.1 KB

    Here's the try catch block in the main function
    Code:
    int main()
    {
    	try
    	{
    		CubeHLSLApp cubeHLSLApp;
    
    		if (cubeHLSLApp.Init() == false)
    			return 1;
    
    		return cubeHLSLApp.Run();
    	}
    	catch (Exeption& ex)
    	{
    		MessageBoxA(nullptr, ex.ToString().c_str(), "ERROR", MB_ICONSTOP);
    		return 1;
    	}
    }
    Thank you.

  2. #2
    Join Date
    Oct 2017
    Posts
    50

    Re: Unhandled exception at TextShaping.dll when throwing an an exeption

    I've found the solution i just need to put some funtion in my base app class destructor
    Code:
    VulkanApp::~VulkanApp()
    {
    	glfwDestroyWindow(mGLFWWindow);
    	glfwTerminate();
    }

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured