Skip to content
This repository has been archived by the owner on Nov 3, 2023. It is now read-only.

插件的部分全局变量无法正常构造 #126

Closed
1 task done
Antares0982 opened this issue Sep 5, 2022 · 1 comment
Closed
1 task done

插件的部分全局变量无法正常构造 #126

Antares0982 opened this issue Sep 5, 2022 · 1 comment
Labels
f: API 关于:公开API p: high 优先级:高 t: bug 类型:bug

Comments

@Antares0982
Copy link
Collaborator

Code of Conduct

  • I conform

问题描述

插件在被调用libOpen()时,初始化所有全局变量。如果存在MiraiCP提供的部分类的对象(如Member),构造函数调用时会尝试call一次ktOperation,此时loader api未设置,在进行checkApi时会出现段错误。

LibLoader::LoaderApi::pluginOperation loaderApi.cpp:56    <---------------------
MiraiCP::KtOperation::ktOperation KtOperation.cpp:28
MiraiCP::LowLevelAPI::getInfoSource LowLevelAPI.cpp:48
MiraiCP::Member::refreshInfo Member.cpp:37
MiraiCP::Member::Member Member.cpp:31    <---------------------
__static_initialization_and_destruction_0 main.cpp:119
_GLOBAL__sub_I_main.cpp(void) main.cpp:1105
<unknown> 0x00007f7a7d19ecee
<unknown> 0x00007f7a7d19eddc
_dl_catch_exception 0x00007f7a7d091da4
<unknown> 0x00007f7a7d1a5557
_dl_catch_exception 0x00007f7a7d091d4e
<unknown> 0x00007f7a7d1a58ed
<unknown> 0x00007f7a7cfc486c
_dl_catch_exception 0x00007f7a7d091d4e
_dl_catch_error 0x00007f7a7d091e03
<unknown> 0x00007f7a7cfc433f
dlopen 0x00007f7a7cfc4921    <---------------------
LibLoader::LoaderApi::libOpen libOpen.h:45
LibLoader::load_plugin PluginListImplements.cpp:146
LibLoader::loadsAll PluginListImplements.cpp:237
LibLoader::registerAllPlugin PluginListImplements.cpp:265
Verify ktInterface.cpp:54
...

预期行为:Member构造时不应抛出任何异常

可能的解决方案:Member等的构造改为lazy construct

日志

No response

版本

v2.12.0-RC

组件

Plugin

@Antares0982 Antares0982 added t: question 类型:问题 t: bug 类型:bug f: API 关于:公开API p: high 优先级:高 and removed t: question 类型:问题 labels Sep 5, 2022
@Antares0982
Copy link
Collaborator Author

dev分支经测试已经解决该问题

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
f: API 关于:公开API p: high 优先级:高 t: bug 类型:bug
Projects
None yet
Development

No branches or pull requests

1 participant