Skip to content

Commit

Permalink
fix: crash of unfound size
Browse files Browse the repository at this point in the history
createSubSplit has side effects, it removes the term form its
parent, so find size of it in QSplitter::sizes crashes.
  • Loading branch information
hualet committed Sep 2, 2024
1 parent 85a2d92 commit a72aac8
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/views/termwidgetpage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -169,16 +169,16 @@ void TermWidgetPage::split(Qt::Orientation orientation)
// if there's no splitter, or the orientation is not correct,
// create a new splitter, put the 2 terms into the splitter,
// and replace the old term with the splitter.
QSplitter *newSplitter = createSubSplit(term, orientation);

if (splitter) {
// see above splitter->insertWidget part to know why.
QList<int> sizes = splitter->sizes();
sizes.insert(index, sizes.at(index));
QSplitter *newSplitter = createSubSplit(term, orientation);
splitter->insertWidget(index, newSplitter);
splitter->setSizes(sizes);
setSplitStyle(splitter);
} else {
QSplitter *newSplitter = createSubSplit(term, orientation);
m_layout->insertWidget(index, newSplitter);
}
}
Expand Down

0 comments on commit a72aac8

Please sign in to comment.