小编Yuw*_* Xu的帖子

VST3 SDK:ClassInfo 对象中 std::string 成员的有问题的构造导致程序崩溃

问题:

我正在尝试使用 SDK 中包含的 VST 托管实用程序来加载插件。代码如图:

#include "vst/v3/Vst3CommonIncludes.h"

int main()
{
    std::string vst3_module_path = R"(C:\Program Files\Common Files\VST3\Kontakt.vst3)";
    std::string error;
    std::shared_ptr<Module> vst_module = Module::create(vst3_module_path, error);
    std::vector<ClassInfo> class_infos = vst_module->getFactory().classInfos();;

    assert(error.empty());
    assert(class_infos.size());

    ClassInfo plugin_info = class_infos[0]; //Crash
    //... load the plugin and do more things
    return 0;
}

Run Code Online (Sandbox Code Playgroud)

其中仅包含来自和 8 的Vst3CommonIncludes.h所有 VST SDK 标头pluginterfaces/vstpublic.sdk/source/vst

就我而言,SDK 包含源文件和 cmake 文件,可将它们构建到静态库中。所以我的代码和SDK代码共享同一个编译器。

VST SDK 来源来自 Steinberg Media


调查完成:

我的调查显示PluginFactory::classInfos()返回了损坏的数据,尝试从它们中分配原因,std::bad_alloc因为 的大小std::string无效。

VST SDK中PluginFactory::classInfos()的定义:

PluginFactory::ClassInfos PluginFactory::classInfos () const …
Run Code Online (Sandbox Code Playgroud)

c++ vst visual-c++

28
推荐指数
1
解决办法
783
查看次数

标签 统计

c++ ×1

visual-c++ ×1

vst ×1