Skip to content

Commit

Permalink
Fixed crash selecting texttool (flameshot-org#2369)
Browse files Browse the repository at this point in the history
(cherry picked from commit 4affa92)
  • Loading branch information
AndreaMarangoni authored and Yuriy Puchkov committed May 13, 2022
1 parent 3510771 commit fb86f8d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
3 changes: 1 addition & 2 deletions src/widgets/capture/capturewidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1113,14 +1113,13 @@ void CaptureWidget::setState(CaptureToolButton* b)

if (b->tool()->isSelectable()) {
if (m_activeButton != b) {
QWidget* confW = b->tool()->configurationWidget();
m_panel->setToolWidget(confW);
if (m_activeButton) {
m_activeButton->setColor(m_uiColor);
}
m_activeButton = b;
m_activeButton->setColor(m_contrastUiColor);
m_panel->setActiveLayer(-1);
m_panel->setToolWidget(b->tool()->configurationWidget());
} else if (m_activeButton) {
m_panel->clearToolWidget();
m_activeButton->setColor(m_uiColor);
Expand Down
6 changes: 3 additions & 3 deletions src/widgets/panel/utilitypanel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,9 @@ QWidget* UtilityPanel::toolWidget() const
void UtilityPanel::setToolWidget(QWidget* w)
{
if (m_toolWidget) {
m_toolWidget->close();
delete m_toolWidget;
m_toolWidget = nullptr;
m_toolWidget->hide();
m_toolWidget->setParent(this);
m_toolWidget->deleteLater();
}
if (w) {
m_toolWidget = w;
Expand Down

0 comments on commit fb86f8d

Please sign in to comment.