I have the following problem: A Component is used to display a list of “addons” in a custom list box. When the user clicks an item in the list, I want to display some addon-specific options next to the list. The list holds references to these addons anyway so i thought, it might be a good idea to implement a member function for each addon like this:
So now, when the user clicks the list, i’d like to let the addon create it’s gui component so I can add it to my window using “addAndMakeVisible”. I call it like this:
However, nothing happens. I guess, it’s got to do with the whole shared_ptr stuff, but I have no idea, whats going on here. Please, can you help me?
That’s why I usually don’t tell people to use shared_ptr…
You only need a member here, not a pointer. Use a reference and you’re done, you’ll avoid useless referenced counting, the mind-twisting weakptr issues and so on.