Fixed plugin loading and closing issues mainly on Windows

This fixes #87
This commit is contained in:
WerWolv
2021-02-07 13:40:47 +01:00
parent 4d7d449cea
commit 5b38c43b7e
8 changed files with 49 additions and 25 deletions

View File

@@ -153,11 +153,11 @@ namespace hex {
size_t size = ftell(file);
rewind(file);
std::vector<char> buffer( size + 1, 0x00);
fread(buffer.data(), 1, size, file);
std::vector<char> patternBuffer( size + 1, 0x00);
fread(patternBuffer.data(), 1, size, file);
fclose(file);
preprocessor.preprocess(buffer.data());
preprocessor.preprocess(patternBuffer.data());
if (foundCorrectType)
this->m_possiblePatternFiles.push_back(entry.path().filename().string());
@@ -289,8 +289,8 @@ namespace hex {
}
void ViewPattern::loadPatternFile(std::string path) {
FILE *file = fopen(path.c_str(), "rb");
void ViewPattern::loadPatternFile(std::string_view path) {
FILE *file = fopen(path.data(), "rb");
if (file != nullptr) {
char *buffer;
@@ -325,7 +325,7 @@ namespace hex {
this->clearPatternData();
this->m_textEditor.SetErrorMarkers({ });
this->m_console.clear();
this->postEvent(Events::PatternChanged);
View::postEvent(Events::PatternChanged);
auto result = this->m_patternLanguageRuntime->executeString(SharedData::currentProvider, buffer);