fix(RD): pass copy of IndexedPack to callbacks instead of ref.
This prevents a crash in which the pack list gets updated in a search request meanwhile a versions / extra info request is being processed. Previously, this situation would cause the reference in the latter callbacks to be invalidated by an internal relocation of the pack list. Signed-off-by: flow <flowlnlnln@gmail.com>
This commit is contained in:
@ -81,7 +81,7 @@ class ResourceAPI {
|
||||
};
|
||||
|
||||
struct VersionSearchArgs {
|
||||
ModPlatform::IndexedPack& pack;
|
||||
ModPlatform::IndexedPack pack;
|
||||
|
||||
std::optional<std::list<Version> > mcVersions;
|
||||
std::optional<ModLoaderTypes> loaders;
|
||||
@ -94,16 +94,16 @@ class ResourceAPI {
|
||||
}
|
||||
};
|
||||
struct VersionSearchCallbacks {
|
||||
std::function<void(QJsonDocument&, ModPlatform::IndexedPack&)> on_succeed;
|
||||
std::function<void(QJsonDocument&, ModPlatform::IndexedPack)> on_succeed;
|
||||
};
|
||||
|
||||
struct ProjectInfoArgs {
|
||||
ModPlatform::IndexedPack& pack;
|
||||
ModPlatform::IndexedPack pack;
|
||||
|
||||
void operator=(ProjectInfoArgs other) { pack = other.pack; }
|
||||
};
|
||||
struct ProjectInfoCallbacks {
|
||||
std::function<void(QJsonDocument&, ModPlatform::IndexedPack&)> on_succeed;
|
||||
std::function<void(QJsonDocument&, ModPlatform::IndexedPack)> on_succeed;
|
||||
};
|
||||
|
||||
public:
|
||||
|
Reference in New Issue
Block a user