Git Product home page Git Product logo

Comments (3)

jpvanoosten avatar jpvanoosten commented on August 14, 2024

It looks like you've made some changes to the code. For example, std::shared_ptr is a template class but you are not specifying any template arguments in the code example. It should be std::shared_ptr<Game> as can be seen here DX12Lib/src/Window.cpp#L188.

Also, when using shared_from_this, your class must publicly inherit from std::enable_shared_from_this<T> (where T is the derived class) as can be seen here: DX12Lib/inc/Game.h#L42.

from learningdirectx12.

safi-huss avatar safi-huss commented on August 14, 2024

It looks like you've made some changes to the code. For example, std::shared_ptr is a template class but you are not specifying any template arguments in the code example. It should be std::shared_ptr as can be seen here DX12Lib/src/Window.cpp#L188.

Sorry, I guess that was my mistake when trying to copy-paste the code and trying to get the code snippet to work. My code does have the template assigned.

`void Window::RegisterCallbacks(std::shared_ptr<Game arg_pGame)
{
m_pGame = arg_pGame;

return;

}
`
EDIT: I had to remove the ending angle brace for some reason, the code snippet tool omits that. The same is so in my original post.

Same goes for the class declarations as follows:

class Game : public std::enable_shared_from_this<Game> {

I tried changing the weak_ptr m_pGame to shared_ptr m_pGame, and commenting out the locks. but still, I get a similar error for Read Access violation.

Some of the ComPtr Objects are uninitialized at this point. Is that to be expected or have I bungled the code?

from learningdirectx12.

safi-huss avatar safi-huss commented on August 14, 2024

I believe I made a grave error in the code. Apparently, my window initialization was incorrect and I was using invalid handles to the Window to initialize the rest of the code.

Thank you so much for bearing my ineptitude. And a million thanks for writing these tutorials!

from learningdirectx12.

Related Issues (18)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.