statically declared shortcut caused crash during children delete in qapp::exit. Small related cleanups
This commit is contained in:
parent
66845a4148
commit
adf0a7a848
@ -402,11 +402,6 @@ int main(int argc, char **argv)
|
|||||||
}
|
}
|
||||||
QTimer::singleShot(0, mainWindow, SLOT(initDbOpen()));
|
QTimer::singleShot(0, mainWindow, SLOT(initDbOpen()));
|
||||||
|
|
||||||
// Connect exit handlers etc.. Beware, apparently this must come
|
|
||||||
// after mainWindow->show()?
|
|
||||||
app.connect(&app, SIGNAL(lastWindowClosed()), &app, SLOT(quit()));
|
|
||||||
app.connect(&app, SIGNAL(aboutToQuit()), mainWindow, SLOT(close()));
|
|
||||||
|
|
||||||
mainWindow->sSearch->searchTypCMB->setCurrentIndex(prefs.ssearchTyp);
|
mainWindow->sSearch->searchTypCMB->setCurrentIndex(prefs.ssearchTyp);
|
||||||
mainWindow->sSearch->searchTypeChanged(prefs.ssearchTyp);
|
mainWindow->sSearch->searchTypeChanged(prefs.ssearchTyp);
|
||||||
if (op_flags & OPT_q) {
|
if (op_flags & OPT_q) {
|
||||||
|
|||||||
@ -203,23 +203,15 @@ void RclMain::periodic100()
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Possibly cleanup the dead viewers
|
// Possibly cleanup the dead viewers
|
||||||
for (vector<ExecCmd*>::iterator it = m_viewers.begin();
|
for (auto it = m_viewers.begin(); it != m_viewers.end(); ) {
|
||||||
it != m_viewers.end(); it++) {
|
|
||||||
int status;
|
int status;
|
||||||
if ((*it)->maybereap(&status)) {
|
if ((*it)->maybereap(&status)) {
|
||||||
deleteZ(*it);
|
delete *it;
|
||||||
|
it = m_viewers.erase(it);
|
||||||
|
} else {
|
||||||
|
it++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
vector<ExecCmd*> v;
|
|
||||||
for (vector<ExecCmd*>::iterator it = m_viewers.begin();
|
|
||||||
it != m_viewers.end(); it++) {
|
|
||||||
if (*it)
|
|
||||||
v.push_back(*it);
|
|
||||||
}
|
|
||||||
m_viewers = v;
|
|
||||||
|
|
||||||
if (recollNeedsExit)
|
|
||||||
fileExit();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// On win32 we have trouble passing filename args on the command line
|
// On win32 we have trouble passing filename args on the command line
|
||||||
|
|||||||
@ -420,7 +420,7 @@ void RclMain::showActiveTypes()
|
|||||||
dialog.groupBox->setTitle(tr("Content has been indexed for these MIME types:"));
|
dialog.groupBox->setTitle(tr("Content has been indexed for these MIME types:"));
|
||||||
|
|
||||||
// We replace the list with an editor so that the user can copy/paste
|
// We replace the list with an editor so that the user can copy/paste
|
||||||
delete dialog.listWidget;
|
deleteZ(dialog.listWidget);
|
||||||
QTextEdit *editor = new QTextEdit(dialog.groupBox);
|
QTextEdit *editor = new QTextEdit(dialog.groupBox);
|
||||||
editor->setReadOnly(true);
|
editor->setReadOnly(true);
|
||||||
dialog.horizontalLayout->addWidget(editor);
|
dialog.horizontalLayout->addWidget(editor);
|
||||||
@ -447,7 +447,7 @@ void RclMain::newDupsW(const Rcl::Doc, const vector<Rcl::Doc> dups)
|
|||||||
dialog.groupBox->setTitle(tr("These Urls ( | ipath) share the same"
|
dialog.groupBox->setTitle(tr("These Urls ( | ipath) share the same"
|
||||||
" content:"));
|
" content:"));
|
||||||
// We replace the list with an editor so that the user can copy/paste
|
// We replace the list with an editor so that the user can copy/paste
|
||||||
delete dialog.listWidget;
|
deleteZ(dialog.listWidget);
|
||||||
QTextEdit *editor = new QTextEdit(dialog.groupBox);
|
QTextEdit *editor = new QTextEdit(dialog.groupBox);
|
||||||
editor->setReadOnly(true);
|
editor->setReadOnly(true);
|
||||||
dialog.horizontalLayout->addWidget(editor);
|
dialog.horizontalLayout->addWidget(editor);
|
||||||
|
|||||||
@ -134,6 +134,10 @@ void RclMain::init()
|
|||||||
DocSequence::set_translations((const char *)tr("sorted").toUtf8(),
|
DocSequence::set_translations((const char *)tr("sorted").toUtf8(),
|
||||||
(const char *)tr("filtered").toUtf8());
|
(const char *)tr("filtered").toUtf8());
|
||||||
|
|
||||||
|
// A shortcut to get the focus back to the search entry, in table
|
||||||
|
// mode only.
|
||||||
|
m_tablefocseq = new QShortcut(QKeySequence("Ctrl+r"), this);
|
||||||
|
|
||||||
periodictimer = new QTimer(this);
|
periodictimer = new QTimer(this);
|
||||||
|
|
||||||
// idxstatus file. Make sure it exists before trying to watch it
|
// idxstatus file. Make sure it exists before trying to watch it
|
||||||
@ -279,7 +283,6 @@ void RclMain::init()
|
|||||||
actionShowResultsAsTable->setChecked(prefs.showResultsAsTable);
|
actionShowResultsAsTable->setChecked(prefs.showResultsAsTable);
|
||||||
on_actionShowResultsAsTable_toggled(prefs.showResultsAsTable);
|
on_actionShowResultsAsTable_toggled(prefs.showResultsAsTable);
|
||||||
|
|
||||||
// A shortcut to get the focus back to the search entry.
|
|
||||||
QKeySequence seq("Ctrl+Shift+s");
|
QKeySequence seq("Ctrl+Shift+s");
|
||||||
QShortcut *sc = new QShortcut(seq, this);
|
QShortcut *sc = new QShortcut(seq, this);
|
||||||
connect(sc, SIGNAL (activated()), sSearch, SLOT (takeFocus()));
|
connect(sc, SIGNAL (activated()), sSearch, SLOT (takeFocus()));
|
||||||
@ -462,8 +465,7 @@ void RclMain::enableTrayIcon(bool on)
|
|||||||
}
|
}
|
||||||
m_trayicon->show();
|
m_trayicon->show();
|
||||||
} else {
|
} else {
|
||||||
delete m_trayicon;
|
deleteZ(m_trayicon);
|
||||||
m_trayicon = 0;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -643,12 +645,12 @@ void RclMain::closeEvent(QCloseEvent *ev)
|
|||||||
} else {
|
} else {
|
||||||
prefs.showmode = PrefsPack::SHOW_NORMAL;
|
prefs.showmode = PrefsPack::SHOW_NORMAL;
|
||||||
}
|
}
|
||||||
|
ev->ignore();
|
||||||
if (prefs.closeToTray && m_trayicon && m_trayicon->isVisible()) {
|
if (prefs.closeToTray && m_trayicon && m_trayicon->isVisible()) {
|
||||||
hide();
|
hide();
|
||||||
ev->ignore();
|
return;
|
||||||
} else {
|
|
||||||
fileExit();
|
|
||||||
}
|
}
|
||||||
|
fileExit();
|
||||||
}
|
}
|
||||||
|
|
||||||
void RclMain::fileExit()
|
void RclMain::fileExit()
|
||||||
@ -684,18 +686,8 @@ void RclMain::fileExit()
|
|||||||
|
|
||||||
rwSettings(true);
|
rwSettings(true);
|
||||||
|
|
||||||
// We should do the right thing and let exit() call all the
|
|
||||||
// cleanup handlers. But we have few persistent resources and qt
|
|
||||||
// exit is a great source of crashes and pita. So do our own
|
|
||||||
// cleanup:
|
|
||||||
deleteAllTempFiles();
|
deleteAllTempFiles();
|
||||||
// and scram out
|
|
||||||
LOGDEB("RclMain: fileExit: calling _Exit(0)\n");
|
|
||||||
#ifdef USING_WEBENGINE
|
|
||||||
qApp->exit(0);
|
qApp->exit(0);
|
||||||
#else
|
|
||||||
_Exit(0);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Start a db query and set the reslist docsource
|
// Start a db query and set the reslist docsource
|
||||||
@ -886,13 +878,12 @@ void RclMain::on_actionShowResultsAsTable_toggled(bool on)
|
|||||||
restable->setVisible(on);
|
restable->setVisible(on);
|
||||||
reslist->setVisible(!on);
|
reslist->setVisible(!on);
|
||||||
actionSaveResultsAsCSV->setEnabled(on);
|
actionSaveResultsAsCSV->setEnabled(on);
|
||||||
static QShortcut tablefocseq(QKeySequence("Ctrl+r"), this);
|
|
||||||
if (!on) {
|
if (!on) {
|
||||||
int docnum = restable->getDetailDocNumOrTopRow();
|
int docnum = restable->getDetailDocNumOrTopRow();
|
||||||
if (docnum >= 0) {
|
if (docnum >= 0) {
|
||||||
reslist->resultPageFor(docnum);
|
reslist->resultPageFor(docnum);
|
||||||
}
|
}
|
||||||
disconnect(&tablefocseq, SIGNAL(activated()),
|
disconnect(m_tablefocseq, SIGNAL(activated()),
|
||||||
restable, SLOT(takeFocus()));
|
restable, SLOT(takeFocus()));
|
||||||
sSearch->takeFocus();
|
sSearch->takeFocus();
|
||||||
} else {
|
} else {
|
||||||
@ -903,7 +894,7 @@ void RclMain::on_actionShowResultsAsTable_toggled(bool on)
|
|||||||
nextPageAction->setEnabled(false);
|
nextPageAction->setEnabled(false);
|
||||||
prevPageAction->setEnabled(false);
|
prevPageAction->setEnabled(false);
|
||||||
firstPageAction->setEnabled(false);
|
firstPageAction->setEnabled(false);
|
||||||
connect(&tablefocseq, SIGNAL(activated()),
|
connect(m_tablefocseq, SIGNAL(activated()),
|
||||||
restable, SLOT(takeFocus()));
|
restable, SLOT(takeFocus()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -48,6 +48,7 @@ class SpecIdxW;
|
|||||||
class WebcacheEdit;
|
class WebcacheEdit;
|
||||||
class ConfIndexW;
|
class ConfIndexW;
|
||||||
class RclTrayIcon;
|
class RclTrayIcon;
|
||||||
|
class QShortcut;
|
||||||
|
|
||||||
#include "ui_rclmain.h"
|
#include "ui_rclmain.h"
|
||||||
|
|
||||||
@ -203,6 +204,7 @@ private:
|
|||||||
QComboBox *m_filtCMB{0};
|
QComboBox *m_filtCMB{0};
|
||||||
QButtonGroup *m_filtBGRP{0};
|
QButtonGroup *m_filtBGRP{0};
|
||||||
QMenu *m_filtMN{0};
|
QMenu *m_filtMN{0};
|
||||||
|
QShortcut *m_tablefocseq{0};
|
||||||
QFileSystemWatcher m_watcher;
|
QFileSystemWatcher m_watcher;
|
||||||
vector<ExecCmd*> m_viewers;
|
vector<ExecCmd*> m_viewers;
|
||||||
ExecCmd *m_idxproc{0}; // Indexing process
|
ExecCmd *m_idxproc{0}; // Indexing process
|
||||||
|
|||||||
@ -120,7 +120,10 @@ unix {
|
|||||||
MOC_DIR = .moc
|
MOC_DIR = .moc
|
||||||
OBJECTS_DIR = .obj
|
OBJECTS_DIR = .obj
|
||||||
LIBS += -L../.libs -lrecoll
|
LIBS += -L../.libs -lrecoll
|
||||||
|
# You will need LD_PRELOAD=/path/to/libasan.xx because -lasan need to be
|
||||||
|
# first in libs, so can't use LIBS +=
|
||||||
|
# QMAKE_CXXFLAGS += -fsanitize=address -fno-omit-frame-pointer
|
||||||
|
|
||||||
!macx {
|
!macx {
|
||||||
# Note: libdir may be substituted with sthing like $(exec_prefix)/lib
|
# Note: libdir may be substituted with sthing like $(exec_prefix)/lib
|
||||||
# at this point and will go as such in the Makefile. Expansion will be
|
# at this point and will go as such in the Makefile. Expansion will be
|
||||||
|
|||||||
@ -590,7 +590,7 @@ void ResTable::init()
|
|||||||
splitter->setSizes(sizes);
|
splitter->setSizes(sizes);
|
||||||
}
|
}
|
||||||
|
|
||||||
delete textBrowser;
|
deleteZ(textBrowser);
|
||||||
m_detail = new ResTableDetailArea(this);
|
m_detail = new ResTableDetailArea(this);
|
||||||
m_detail->setReadOnly(true);
|
m_detail->setReadOnly(true);
|
||||||
m_detail->setUndoRedoEnabled(false);
|
m_detail->setUndoRedoEnabled(false);
|
||||||
|
|||||||
@ -60,14 +60,6 @@ SearchClauseW::SearchClauseW(QWidget* parent)
|
|||||||
connect(sTpCMB, SIGNAL(activated(int)), this, SLOT(tpChange(int)));
|
connect(sTpCMB, SIGNAL(activated(int)), this, SLOT(tpChange(int)));
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* Destroys the object and frees any allocated resources
|
|
||||||
*/
|
|
||||||
SearchClauseW::~SearchClauseW()
|
|
||||||
{
|
|
||||||
// no need to delete child widgets, Qt does it all for us
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Sets the strings of the subwidgets using the current
|
* Sets the strings of the subwidgets using the current
|
||||||
* language.
|
* language.
|
||||||
|
|||||||
@ -35,7 +35,6 @@ class SearchClauseW : public QWidget
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
SearchClauseW(QWidget* parent = 0);
|
SearchClauseW(QWidget* parent = 0);
|
||||||
~SearchClauseW();
|
|
||||||
Rcl::SearchDataClause *getClause();
|
Rcl::SearchDataClause *getClause();
|
||||||
void setFromClause(Rcl::SearchDataClauseSimple *cl);
|
void setFromClause(Rcl::SearchDataClauseSimple *cl);
|
||||||
void clear();
|
void clear();
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user