fix: crash due to memory bad access
This commit is contained in:
parent
6b0ca127c8
commit
c2d072e60a
@ -110,17 +110,18 @@ GnupgTab::GnupgTab(QWidget* parent)
|
|||||||
ui_->optionDetailsTable->setFocusPolicy(Qt::NoFocus);
|
ui_->optionDetailsTable->setFocusPolicy(Qt::NoFocus);
|
||||||
ui_->optionDetailsTable->setAlternatingRowColors(true);
|
ui_->optionDetailsTable->setAlternatingRowColors(true);
|
||||||
|
|
||||||
|
connect(this, &GnupgTab::SignalGnuPGInfoGathered, this,
|
||||||
|
&GnupgTab::slot_process_software_info);
|
||||||
|
|
||||||
if (GFModuleRetrieveRTValueOrDefaultBool(
|
if (GFModuleRetrieveRTValueOrDefaultBool(
|
||||||
DUP("ui"), DUP("env.state.gnupg_info_gathering"), 0) == 1) {
|
DUP("ui"), DUP("env.state.gnupg_info_gathering"), 0) == 1) {
|
||||||
process_software_info();
|
slot_process_software_info();
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
auto future = QtConcurrent::run(QThreadPool::globalInstance(),
|
slot_gather_gnupg_info();
|
||||||
[=]() { gather_gnupg_info(); });
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void GnupgTab::process_software_info() {
|
void GnupgTab::slot_process_software_info() {
|
||||||
const auto gnupg_version = UDUP(GFModuleRetrieveRTValueOrDefault(
|
const auto gnupg_version = UDUP(GFModuleRetrieveRTValueOrDefault(
|
||||||
DUP("core"), DUP("gpgme.ctx.gnupg_version"), DUP("2.0.0")));
|
DUP("core"), DUP("gpgme.ctx.gnupg_version"), DUP("2.0.0")));
|
||||||
|
|
||||||
@ -322,15 +323,25 @@ void GnupgTab::process_software_info() {
|
|||||||
ui_->tabWidget->setDisabled(false);
|
ui_->tabWidget->setDisabled(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GnupgTab::gather_gnupg_info() {
|
void GnupgTab::slot_gather_gnupg_info() {
|
||||||
ui_->loadProgressBar->show();
|
ui_->loadProgressBar->show();
|
||||||
ui_->tabWidget->setDisabled(true);
|
ui_->tabWidget->setDisabled(true);
|
||||||
|
|
||||||
if (StartGatheringAllGnuPGInfo() >= 0) {
|
new GnupgTabWatcher(this);
|
||||||
GFModuleUpsertRTValueBool(DUP("ui"), DUP("env.state.gnupg_info_gathering"),
|
}
|
||||||
1);
|
|
||||||
process_software_info();
|
GnupgTabWatcher::GnupgTabWatcher(GnupgTab* tab) {
|
||||||
}
|
connect(this, &GnupgTabWatcher::SignalGnuPGInfoGathered, tab,
|
||||||
|
&GnupgTab::SignalGnuPGInfoGathered);
|
||||||
|
|
||||||
|
auto future = QtConcurrent::run(QThreadPool::globalInstance(), [=]() {
|
||||||
|
if (StartGatheringAllGnuPGInfo() >= 0) {
|
||||||
|
GFModuleUpsertRTValueBool(DUP("ui"),
|
||||||
|
DUP("env.state.gnupg_info_gathering"), 1);
|
||||||
|
emit SignalGnuPGInfoGathered();
|
||||||
|
}
|
||||||
|
this->deleteLater();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
auto GnupgTabFactory(void*) -> void* { return new GnupgTab(); }
|
auto GnupgTabFactory(void*) -> void* { return new GnupgTab(); }
|
@ -46,18 +46,41 @@ class GnupgTab : public QWidget {
|
|||||||
*/
|
*/
|
||||||
explicit GnupgTab(QWidget* parent = nullptr);
|
explicit GnupgTab(QWidget* parent = nullptr);
|
||||||
|
|
||||||
|
signals:
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
void SignalGnuPGInfoGathered();
|
||||||
|
|
||||||
|
private slots:
|
||||||
|
/**
|
||||||
|
* @brief
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
void slot_process_software_info();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
void slot_gather_gnupg_info();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::shared_ptr<Ui_GnuPGInfo> ui_; ///<
|
std::shared_ptr<Ui_GnuPGInfo> ui_; ///<
|
||||||
|
};
|
||||||
/**
|
|
||||||
* @brief
|
class GnupgTabWatcher : public QObject {
|
||||||
*
|
Q_OBJECT
|
||||||
*/
|
public:
|
||||||
void process_software_info();
|
/**
|
||||||
|
* @brief Construct a new Gnupg Tab Watcher object
|
||||||
/**
|
*
|
||||||
* @brief
|
* @param tab
|
||||||
*
|
*/
|
||||||
*/
|
explicit GnupgTabWatcher(GnupgTab* tab);
|
||||||
void gather_gnupg_info();
|
|
||||||
|
signals:
|
||||||
|
void SignalGnuPGInfoGathered();
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user