Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Hopefully I'm understanding this correctly.</p> <p>It seems to me that the problem is trying to copy those vtrTextTrack structs improperly. This:</p> <pre><code>//texttrack = track; </code></pre> <p>just copies the pointer. If the owner of the struct (probably the caller of the callback function) destroys/deletes the vtrTextTrack, then you're holding on to an invalid pointer.</p> <p>This one:</p> <pre><code>memcpy(texttrack,track,sizeof(*track)); </code></pre> <p>will copy all the members of the vtrTextTrack, but will not copy what's being pointed to by it's member pointers (e.g. <code>texttrack-&gt;best</code>). Again, if the owner destroys/deletes the track, then you're holding on to invalid pointers.</p> <p>And since</p> <pre><code>//texttrack = new vtrTextTrack (*track); </code></pre> <p>didn't work, I'm guessing that vtrTextTrack doesn't provide a copy constructor.</p> <p>As for a workaround, first check if your third party library provides a function to copy these structs. If that's not the case (could this be by design?), then you may have to implement one yourself. This might be hard because there might be all kinds of internals that you don't know about. If you don't need the whole vtrTextTrack, I'd say define another struct and store only the information you need. Something along the lines of</p> <pre><code>SomeType* bestCopier(SomeType* src) { SomeType* temp; /* copy over struct */ return temp; } Foo* fooCopier(Foo* src) { /*...*/ } struct myTextTrack { public: myTextTrack(vtrTextTrack* src) { //copy over stuff m_best = bestCopier(src-&gt;best); m_foo = fooCopier(src-&gt;foo); } private: /* the members you care about*/ SomeType* m_best; Foo * m_foo; } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload