anastaciu
anastaciu

Reputation: 23832

Pass vector reference to window process

I'm passing a struct that contains a vector reference to a window process using:

SetWindowLongPtr(hWnd, 0, (LONG_PTR)&windowExtraData);

In the function that creates the window. windowExtraData will contain the mentioned reference.


Within the window process function I get the passed data with:

auto* windowExtraData = (WindowExtraData*)GetWindowLongPtr(hWnd, 0);

Should I be worried with memory issues, I mean, when I grow the vector?

Upvotes: 0

Views: 97

Answers (1)

theroyn
theroyn

Reputation: 618

The vector's growth is internal, and its address doesn't change because of it. Therefore, you can do whatever you'd like with it inside. Note that if windowExtraData is destroyed the pointer won't be valid anymore.

Upvotes: 1

Related Questions