Skip to content

Commit 564acb1

Browse files
style: replaced new std::thread with .detach()
1 parent f26ca3e commit 564acb1

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

src/PluginManager.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -189,9 +189,9 @@ std::optional<std::string> Plugin::getStartupScript()
189189

190190
void PluginManager::performForceInstallAndUpdateAsync(const std::string& source)
191191
{
192-
new std::thread([source]() {
192+
std::thread([source]() {
193193
performForceInstallAndUpdateSync(source);
194-
});
194+
}).detach();
195195
}
196196

197197
void PluginManager::loadAll() {

src/v8NativeCalls.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -354,13 +354,13 @@ int _stdcall execute(struct _cef_v8handler_t* self,
354354
}
355355

356356
auto* fn = new JSFunction(callback, cef_v8context_get_current_context());
357-
new std::thread([=]() {
357+
std::thread([=]() {
358358
std::vector<std::string> paths;
359359
std::ifstream t(path);
360360
std::stringstream buffer;
361361
buffer << t.rdbuf();
362362
(*fn)(buffer.str());
363-
});
363+
}).detach();
364364
return create_v8value();
365365
}
366366
);
@@ -372,13 +372,13 @@ int _stdcall execute(struct _cef_v8handler_t* self,
372372
path = datapath + L"/" + path;
373373
}
374374
auto* fn = new JSFunction(callback);
375-
auto thread = new std::thread([=]() {
375+
auto thread = std::thread([=]() {
376376
util::watchDir(path, [&](BNString dir, BNString path) {
377377
(*fn)(dir, path);
378378
if (!fn->isValid())return false;
379379
return true;
380380
});
381-
});
381+
}).detach();
382382
return create_v8value();
383383
}
384384
);

0 commit comments

Comments
 (0)