TheoraVideoManager wont initialize Unhandled exception at 0x7329E13D (msvcr110.dll)

StackOverflow https://stackoverflow.com/questions/18167350

  •  24-06-2022
  •  | 
  •  

Question

I seem to have a problem where i keep getting an unhandled exception exception due to TheoraVideoManager not initializing basically i'm getting Unhandled exception at 0x7329E13D (msvcr110.dll) in Win32Project1.exe: 0xC0000005: Access violation reading location 0x00194000.

here is how i'm doing it

#include <theoraplayer/TheoraPlayer.h>
#include <theoraplayer/TheoraDataSource.h>
#include "theoraplayer/TheoraVideoManager.h"
TheoraVideoManager *mgr ;

/////////////////////////////////

void  init(void)
{
mgr=new TheoraVideoManager();
char* x="one.ogg";
Texttemp=new THVideo(x);
}

////////////

Video.h
extern TheoraVideoManager *mgr ;

//////////////

    THVideo(char* File){        
  ///// crashes here on clip
        clip=mgr->createVideoClip(new TheoraMemoryFileDataSource(File));
        clip->setAutoRestart(1);
        clip->pause();
        texture->texID=createTexture(nextPow2(clip->getWidth()),nextPow2(clip->getHeight()), textureFormat);

    }

/////////////////////////////

Was it helpful?

Solution

Your code doesn't take care if pointers you use are init with something different of NULL. so if something is incorrect at your manager initialization or clip init you use the pointer and crash without more details.

First declare the manager as a static with a null value.

TheoraVideoManager *mgr = NULL;

Now supposing that THVideo is a class, and that clip is a data member. In all your code check if pointer arn't null like below and throw exception if something goes wrong .

THVideo(const char* File){        
     if (mgr == NULL)
      { throw "null pointer";}

    clip=mgr->createVideoClip(new TheoraMemoryFileDataSource(File));
    if(clip == NULL)
     { throw "error on file data source" }

      .....
  }
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top