首页 文章

TheoraVideoManager不会在0x7329E13D(msvcr110.dll)初始化未处理的异常

提问于
浏览
2

我似乎有一个问题,我继续得到一个未处理的异常异常,因为TheoraVideoManager没有初始化基本上我在Win32Project1.exe中的0x7329E13D(msvcr110.dll)得到未处理的异常:0xC0000005:访问冲突读取位置0x00194000 .

这是我如何做到这一点

#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);

    }

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

1 回答

  • 3

    如果你使用的指针初始化为不同的NULL,你的代码就不会小心了 . 因此,如果在管理器初始化或剪辑初始化时出现问题,则使用指针并在没有更多细节的情况下崩溃 .

    首先将管理器声明为具有空值的静态 .

    TheoraVideoManager *mgr = NULL;
    

    现在假设THVideo是一个类,该剪辑是数据成员 . 在你的所有代码中检查指针是否如下所示为null,如果出现错误则抛出异常 .

    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" }
    
          .....
      }
    

相关问题