Skip to content

Commit 2e2d941

Browse files
committed
Fix mne_browse segfault: dangling QFile in openFiffRawData
QFile rawFile was local to openFiffRawData() but FiffRawData's internal FiffStream held a pointer to it. After the function returned, read_raw_segment() called isOpen() on the destroyed QFile → SIGSEGV. Fix: use the persistent member m_qFileRaw directly.
1 parent 5e65a2b commit 2e2d941

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/applications/mne_browse/Windows/mainwindow.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1224,8 +1224,11 @@ bool MainWindow::openFiffRawData(FIFFLIB::FiffRawData& raw, const QString& featu
12241224
statusBar()->showMessage(tr("Load a raw FIF file before using %1.").arg(label), 5000);
12251225
return false;
12261226
}
1227-
QFile rawFile(m_qFileRaw.fileName());
1228-
raw = FIFFLIB::FiffRawData(rawFile);
1227+
// Re-open the member QFile so FiffRawData's internal FiffStream holds a
1228+
// valid QIODevice* that outlives this function call.
1229+
if (m_qFileRaw.isOpen())
1230+
m_qFileRaw.close();
1231+
raw = FIFFLIB::FiffRawData(m_qFileRaw);
12291232
#endif
12301233

12311234
if (raw.isEmpty()) {

0 commit comments

Comments
 (0)