- fix: crash when closing the options dialog under Ubuntu 20.04 LTS ( no memory leak now)

This commit is contained in:
Roy Qu 2022-01-09 17:42:23 -08:00
parent 9ea32df675
commit e30fa7bc0c
3 changed files with 8 additions and 26 deletions

View File

@ -19,16 +19,6 @@ DEFINES += PREFIX=\\\"$${PREFIX}\\\"
DEFINES += APP_NAME=\\\"$${APP_NAME}\\\"
DEFINES += REDPANDA_CPP_VERSION=\\\"$${APP_VERSION}\\\"
linux: {
LINUX_DISTRO = $$system(cat /etc/issue)
contains(LINUX_DISTRO, .*Ubuntu.*){
contains(LINUX_DISTRO, .*20\.04.*) {
message("Found Ubuntu 20.04")
DEFINES += SETTINGS_DIALOG_FIX
}
}
}
gcc {
QMAKE_CXXFLAGS_RELEASE += -Werror=return-type
QMAKE_CXXFLAGS_DEBUG += -Werror=return-type

View File

@ -1,4 +1,4 @@
/*
/*
* Copyright (C) 2020-2022 Roy Qu (royqh1979@gmail.com)
*
* This program is free software: you can redistribute it and/or modify
@ -183,14 +183,14 @@ Editor::Editor(QWidget *parent, const QString& filename,
}
Editor::~Editor() {
if (mParentPageControl) {
pMainWindow->fileSystemWatcher()->removePath(mFilename);
pMainWindow->caretList().removeEditor(this);
pMainWindow->updateCaretActions();
if (mParentPageControl!=nullptr) {
int index = mParentPageControl->indexOf(this);
mParentPageControl->removeTab(index);
}
this->setParent(nullptr);
}
}
void Editor::loadFile(QString filename) {
@ -1522,7 +1522,7 @@ void Editor::onStatusChanged(SynStatusChanges changes)
pMainWindow->updateEditorActions();
if (changes.testFlag(SynStatusChange::scCaretY)) {
if (changes.testFlag(SynStatusChange::scCaretY) && mParentPageControl) {
pMainWindow->caretList().addCaret(this,caretY(),caretX());
pMainWindow->updateCaretActions();
}

View File

@ -88,13 +88,6 @@ SettingsDialog::~SettingsDialog()
{
for (SettingsWidget* p:mSettingWidgets) {
p->setParent(nullptr);
//dirty fix for ubuntu 20.04 LTS
#ifdef SETTINGS_DIALOG_FIX
if (p->group()==tr("Editor") && p->name()==tr("Color"))
continue;
if (p->group()==tr("Editor") && p->name()==tr("Snippet"))
continue;
#endif
delete p;
}
delete ui;
@ -152,12 +145,11 @@ PSettingsDialog SettingsDialog::optionDialog()
dialog->addWidget(widget);
widget = new EnvironmentFoldersWidget(tr("Folders"),tr("Environment"));
dialog->addWidget(widget);
connect((EnvironmentFoldersWidget*)widget,
&EnvironmentFoldersWidget::shouldQuitApp,
dialog.get(),
&SettingsDialog::closeAndQuit);
dialog->addWidget(widget);
#ifdef Q_OS_LINUX
widget = new EnvironmentProgramsWidget(tr("Terminal"),tr("Environment"));