Platform: WebAssembly only
Files: connector.cpp:368, auxconnector.cpp:245
What's wrong
wasmOpenProof and wasmImportProof both capture pointer parameters by reference in async lambdas. On WASM, QFileDialog::getOpenFileContent returns immediately and the callback fires later, by then the stack frame is gone and all captured references are dangling. This is use-after-free / undefined behaviour.
// connector.cpp:368
auto fileContentReady = [&open, this, &gls](...) { ... }; // &open, &gls dangle after return
// auxconnector.cpp:245
auto fileContentReady = [this, &c, &pd, &pm](...) { ... }; // &c, &pd, &pm dangle after return
Fix
Capture by value: these are already pointers so copying is just 8 bytes each.
// connector.cpp
auto fileContentReady = [open, this, gls](...) { ... };
// auxconnector.cpp
auto fileContentReady = [this, c, pd, pm](...) { ... };
&open → open, &gls → gls, &c → c, &pd → pd, &pm → pm.
The pointed-to objects are long-lived Qt UI models that outlive any file dialog, so capturing pointer values is safe.
Platform: WebAssembly only
Files:
connector.cpp:368,auxconnector.cpp:245What's wrong
wasmOpenProofandwasmImportProofboth capture pointer parameters by reference in async lambdas. On WASM,QFileDialog::getOpenFileContentreturns immediately and the callback fires later, by then the stack frame is gone and all captured references are dangling. This is use-after-free / undefined behaviour.Fix
Capture by value: these are already pointers so copying is just 8 bytes each.
&open→open,&gls→gls,&c→c,&pd→pd,&pm→pm.The pointed-to objects are long-lived Qt UI models that outlive any file dialog, so capturing pointer values is safe.