Skip to content

Commit

Permalink
fixed crash on chat close
Browse files Browse the repository at this point in the history
  • Loading branch information
Ri0n committed Mar 16, 2024
1 parent ff29a16 commit 91c52fe
Show file tree
Hide file tree
Showing 7 changed files with 32 additions and 31 deletions.
2 changes: 1 addition & 1 deletion src/chateditproxy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ void ChatEditProxy::updateLayout()
delete textEdit_;
textEdit_ = newEdit;
layout_->addWidget(textEdit_);
emit textEditCreated(textEdit_);
emit textEditCreated();
}

/**
Expand Down
2 changes: 1 addition & 1 deletion src/chateditproxy.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ class ChatEditProxy : public QWidget {
* Emitted when internal QTextEdit gets replaced with
* another one.
*/
void textEditCreated(QTextEdit *textEdit);
void textEditCreated();

protected:
/**
Expand Down
2 changes: 1 addition & 1 deletion src/groupchatdlg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1018,7 +1018,7 @@ GCMainDlg::GCMainDlg(PsiAccount *pa, const Jid &j, TabManager *tabManager) : Tab
connect(d->act_scrolldown, SIGNAL(triggered()), SLOT(scrollDown()));

ui_.mini_prompt->hide();
connect(ui_.mle, SIGNAL(textEditCreated(QTextEdit *)), SLOT(chatEditCreated()));
connect(ui_.mle, &ChatEditProxy::textEditCreated, this, &GCMainDlg::chatEditCreated);
chatEditCreated();
ui_.log->init(); // we are ready to do that now. chatEditCreated() inited last pieces required for this init

Expand Down
5 changes: 3 additions & 2 deletions src/msgmle.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -259,9 +259,10 @@ void ChatEdit::setCheckSpelling(bool b)
check_spelling_ = b;
if (check_spelling_) {
if (!spellhighlighter_)
spellhighlighter_.reset(new SpellHighlighter(document()));
spellhighlighter_ = new SpellHighlighter(this);
} else {
spellhighlighter_.reset();
delete spellhighlighter_;
spellhighlighter_ = nullptr;
}
document()->blockSignals(false);
}
Expand Down
48 changes: 24 additions & 24 deletions src/msgmle.h
Original file line number Diff line number Diff line change
Expand Up @@ -114,30 +114,30 @@ protected slots:
void setRecButtonIcon();

private:
QWidget *dialog_ = nullptr;
bool check_spelling_ = false;
std::unique_ptr<SpellHighlighter> spellhighlighter_;
QPoint last_click_;
int previous_position_ = 0;
QStringList typedMsgsHistory;
int typedMsgsIndex = 0;
QAction *act_showMessagePrev = nullptr;
QAction *act_showMessageNext = nullptr;
QAction *act_showMessageFirst = nullptr;
QAction *act_showMessageLast = nullptr;
QAction *act_changeCase = nullptr;
QAction *actPasteAsQuote_ = nullptr;
QString currentText;
HTMLTextController *controller_ = nullptr;
CapitalLettersController *capitalizer_ = nullptr;
bool correction = false;
QString lastId;
QPointer<QLayout> layout_;
QPointer<QToolButton> recButton_;
QPointer<QLabel> overlay_;
QPointer<QTimer> timer_;
std::unique_ptr<AudioRecorder> recorder_;
int timeout_;
QWidget *dialog_ = nullptr;
bool check_spelling_ = false;
SpellHighlighter *spellhighlighter_ = nullptr;
QPoint last_click_;
int previous_position_ = 0;
QStringList typedMsgsHistory;
int typedMsgsIndex = 0;
QAction *act_showMessagePrev = nullptr;
QAction *act_showMessageNext = nullptr;
QAction *act_showMessageFirst = nullptr;
QAction *act_showMessageLast = nullptr;
QAction *act_changeCase = nullptr;
QAction *actPasteAsQuote_ = nullptr;
QString currentText;
HTMLTextController *controller_ = nullptr;
CapitalLettersController *capitalizer_ = nullptr;
bool correction = false;
QString lastId;
QPointer<QLayout> layout_;
QPointer<QToolButton> recButton_;
QPointer<QLabel> overlay_;
QPointer<QTimer> timer_;
std::unique_ptr<AudioRecorder> recorder_;
int timeout_;
};

class LineEdit : public ChatEdit {
Expand Down
2 changes: 1 addition & 1 deletion src/psichatdlg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,7 @@ void PsiChatDlg::initUi()

ui_.tb_emoticons->setIcon(IconsetFactory::icon("psi/smile").icon());

connect(ui_.mle, SIGNAL(textEditCreated(QTextEdit *)), SLOT(chatEditCreated()));
connect(ui_.mle, &ChatEditProxy::textEditCreated, this, &PsiChatDlg::chatEditCreated);
chatEditCreated();

#ifdef Q_OS_MAC
Expand Down

0 comments on commit 91c52fe

Please sign in to comment.