mirror of
https://bitbucket.org/smil3y/kdelibs.git
synced 2025-02-23 18:32:49 +00:00
generic: misc cleanups
Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
parent
c689c26b26
commit
5600c15dec
13 changed files with 84 additions and 105 deletions
|
@ -30,7 +30,9 @@ using namespace KTextEditor;
|
|||
|
||||
|
||||
DocumentAdaptor::DocumentAdaptor(Document *document):
|
||||
QDBusAbstractAdaptor(document),m_document(document) {
|
||||
QDBusAbstractAdaptor(document),
|
||||
m_document(document)
|
||||
{
|
||||
}
|
||||
|
||||
DocumentAdaptor::~DocumentAdaptor() {}
|
||||
|
|
|
@ -109,12 +109,9 @@ static int lowerBound(const QList<SmartRange*>& ranges, const Cursor& pos)
|
|||
int begin = 0;
|
||||
int n = ranges.count();
|
||||
|
||||
int half;
|
||||
int middle;
|
||||
|
||||
while (n > 0) {
|
||||
half = n >> 1;
|
||||
middle = begin + half;
|
||||
int half = n >> 1;
|
||||
int middle = begin + half;
|
||||
if(ranges[middle]->end() > pos) {
|
||||
n = half;
|
||||
}else{
|
||||
|
@ -132,12 +129,9 @@ static int lowerBoundRange(const QList<SmartRange*>& ranges, const Cursor& pos,
|
|||
int begin = 0;
|
||||
int n = ranges.count();
|
||||
|
||||
int half;
|
||||
int middle;
|
||||
|
||||
while (n > 0) {
|
||||
half = n >> 1;
|
||||
middle = begin + half;
|
||||
int half = n >> 1;
|
||||
int middle = begin + half;
|
||||
if(ranges[begin] == range)
|
||||
return begin;
|
||||
if(ranges[middle] == range)
|
||||
|
|
|
@ -46,25 +46,17 @@ void helperDebugHandler(QtMsgType type, const char *msg);
|
|||
|
||||
static bool remote_dbg = false;
|
||||
|
||||
#ifdef Q_OS_UNIX
|
||||
static void fixEnvironment()
|
||||
{
|
||||
//try correct HOME
|
||||
const char *home = "HOME";
|
||||
if(getenv(home)==NULL)
|
||||
{
|
||||
struct passwd *pw = getpwuid(getuid());
|
||||
int overwrite = 0;
|
||||
|
||||
if (pw!=NULL) setenv(home, pw->pw_dir, overwrite);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
int HelperSupport::helperMain(int argc, char **argv, const char *id, QObject *responder)
|
||||
{
|
||||
#ifdef Q_OS_UNIX
|
||||
fixEnvironment();
|
||||
//try correct HOME
|
||||
const char *home = "HOME";
|
||||
if(getenv(home)==NULL) {
|
||||
struct passwd *pw = getpwuid(getuid());
|
||||
if (pw!=NULL) {
|
||||
setenv(home, pw->pw_dir, 0 /* overwrite */);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
openlog(id, 0, LOG_USER);
|
||||
|
|
|
@ -636,7 +636,7 @@ void KCoreConfigSkeleton::ItemULongLong::setMaxValue(quint64 v)
|
|||
KCoreConfigSkeleton::ItemDouble::ItemDouble( const QString &_group, const QString &_key,
|
||||
double &reference, double defaultValue )
|
||||
: KConfigSkeletonGenericItem<double>( _group, _key, reference, defaultValue )
|
||||
,mHasMin(false), mHasMax(false)
|
||||
, mHasMin(false), mHasMax(false)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -1428,14 +1428,13 @@ QString KDateTime::toString(const QString &format) const
|
|||
KCalendarSystemQDate calendar(locale);
|
||||
QString result;
|
||||
QString s;
|
||||
int num, numLength, zone;
|
||||
bool escape = false;
|
||||
ushort flag = 0;
|
||||
for (int i = 0, end = format.length(); i < end; ++i)
|
||||
{
|
||||
zone = TZNone;
|
||||
num = NO_NUMBER;
|
||||
numLength = 0; // no leading zeroes
|
||||
int zone = TZNone;
|
||||
int num = NO_NUMBER;
|
||||
int numLength = 0; // no leading zeroes
|
||||
ushort ch = format[i].unicode();
|
||||
if (!escape)
|
||||
{
|
||||
|
|
|
@ -657,13 +657,10 @@ int
|
|||
KCmdLineArgsStatic::findOption(const KCmdLineOptions &options, QByteArray &opt,
|
||||
QByteArray &opt_name, QString &def, bool &enabled)
|
||||
{
|
||||
int result;
|
||||
bool inverse;
|
||||
|
||||
for (int i = 0; i < options.d->names.size(); i++)
|
||||
{
|
||||
result = 0;
|
||||
inverse = false;
|
||||
int result = 0;
|
||||
bool inverse = false;
|
||||
opt_name = options.d->names[i];
|
||||
if (opt_name.startsWith(':') || opt_name.isEmpty())
|
||||
{
|
||||
|
|
|
@ -134,7 +134,7 @@ make_unix(const char *name, const char *serv)
|
|||
struct sockaddr_un *_sun;
|
||||
int len;
|
||||
|
||||
p = (addrinfo*)malloc(sizeof(*p));
|
||||
p = static_cast<addrinfo*>(malloc(sizeof(*p)));
|
||||
if (p == NULL)
|
||||
return NULL;
|
||||
memset(p, 0, sizeof(*p));
|
||||
|
@ -149,7 +149,7 @@ make_unix(const char *name, const char *serv)
|
|||
if (*buf != '/')
|
||||
len += 5; // strlen("/tmp/");
|
||||
|
||||
_sun = (sockaddr_un*)malloc(len);
|
||||
_sun = static_cast<sockaddr_un*>(malloc(len));
|
||||
if (_sun == NULL)
|
||||
{
|
||||
// Oops
|
||||
|
@ -240,7 +240,7 @@ int kde_getaddrinfo(const char *name, const char *service,
|
|||
#endif
|
||||
|
||||
// allocate memory for results
|
||||
res = (kde_addrinfo*)malloc(sizeof(*res));
|
||||
res = static_cast<kde_addrinfo*>(malloc(sizeof(*res)));
|
||||
if (res == NULL)
|
||||
return EAI_MEMORY;
|
||||
res->data = NULL;
|
||||
|
@ -425,7 +425,7 @@ static int inet_lookup(const char *name, int portnum, int protonum,
|
|||
}
|
||||
}
|
||||
|
||||
q = (addrinfo*)malloc(sizeof(*q));
|
||||
q = static_cast<addrinfo*>(malloc(sizeof(*q)));
|
||||
if (q == NULL)
|
||||
{
|
||||
freeaddrinfo(p);
|
||||
|
@ -502,7 +502,7 @@ static int inet_lookup(const char *name, int portnum, int protonum,
|
|||
// cycle through the rest of the hosts;
|
||||
for (psa = (sockaddr**)h->h_addr_list + 1; *psa; psa++)
|
||||
{
|
||||
q = (addrinfo*)malloc(sizeof(*q));
|
||||
q = static_cast<addrinfo*>(malloc(sizeof(*q)));
|
||||
if (q == NULL)
|
||||
{
|
||||
freeaddrinfo(p);
|
||||
|
@ -510,7 +510,7 @@ static int inet_lookup(const char *name, int portnum, int protonum,
|
|||
}
|
||||
memcpy(q, p, sizeof(*q));
|
||||
|
||||
q->ai_addr = (sockaddr*)malloc(h->h_length);
|
||||
q->ai_addr = static_cast<sockaddr*>(malloc(h->h_length));
|
||||
if (q->ai_addr == NULL)
|
||||
{
|
||||
freeaddrinfo(p);
|
||||
|
@ -644,14 +644,14 @@ static int make_inet(const char *name, int portnum, int protonum, struct addrinf
|
|||
break; // not a numeric host, do lookup
|
||||
}
|
||||
|
||||
sin = (sockaddr_in*)malloc(sizeof(*sin));
|
||||
sin = static_cast<sockaddr_in*>(malloc(sizeof(*sin)));
|
||||
if (sin == NULL)
|
||||
{
|
||||
freeaddrinfo(p);
|
||||
return EAI_MEMORY;
|
||||
}
|
||||
|
||||
q = (addrinfo*)malloc(sizeof(*q));
|
||||
q = static_cast<addrinfo*>(malloc(sizeof(*q)));
|
||||
if (q == NULL)
|
||||
{
|
||||
freeaddrinfo(p);
|
||||
|
@ -702,7 +702,7 @@ static int make_inet(const char *name, int portnum, int protonum, struct addrinf
|
|||
}
|
||||
|
||||
// Do IPv4 first
|
||||
q = (addrinfo*)malloc(sizeof(*q));
|
||||
q = static_cast<addrinfo*>(malloc(sizeof(*q)));
|
||||
if (q == NULL)
|
||||
{
|
||||
free(sin);
|
||||
|
@ -930,7 +930,7 @@ static void findport(unsigned short port, char *serv, size_t servlen, int flags)
|
|||
if ((flags & NI_NUMERICSERV) == 0)
|
||||
{
|
||||
struct servent *sent;
|
||||
sent = getservbyport(ntohs(port), flags & NI_DGRAM ? "udp" : "tcp");
|
||||
sent = getservbyport(ntohs(port), (flags & NI_DGRAM) ? "udp" : "tcp");
|
||||
if (sent != NULL && servlen > strlen(sent->s_name))
|
||||
{
|
||||
strcpy(serv, sent->s_name);
|
||||
|
|
|
@ -74,48 +74,49 @@ void KTraderParse_error( const char* err )
|
|||
|
||||
void* KTraderParse_newOR( void *_ptr1, void *_ptr2 )
|
||||
{
|
||||
return new ParseTreeOR( (ParseTreeBase*)_ptr1, (ParseTreeBase*)_ptr2 );
|
||||
return new ParseTreeOR( static_cast<ParseTreeBase*>(_ptr1), static_cast<ParseTreeBase*>(_ptr2) );
|
||||
}
|
||||
|
||||
void* KTraderParse_newAND( void *_ptr1, void *_ptr2 )
|
||||
{
|
||||
return new ParseTreeAND( (ParseTreeBase*)_ptr1, (ParseTreeBase*)_ptr2 );
|
||||
return new ParseTreeAND( static_cast<ParseTreeBase*>(_ptr1), static_cast<ParseTreeBase*>(_ptr2) );
|
||||
}
|
||||
|
||||
void* KTraderParse_newCMP( void *_ptr1, void *_ptr2, int _i )
|
||||
{
|
||||
return new ParseTreeCMP( (ParseTreeBase*)_ptr1, (ParseTreeBase*)_ptr2, _i );
|
||||
return new ParseTreeCMP( static_cast<ParseTreeBase*>(_ptr1), static_cast<ParseTreeBase*>(_ptr2), _i );
|
||||
}
|
||||
|
||||
void* KTraderParse_newIN( void *_ptr1, void *_ptr2, int _cs )
|
||||
{
|
||||
return new ParseTreeIN( (ParseTreeBase*)_ptr1, (ParseTreeBase*)_ptr2, _cs == 1 ? Qt::CaseSensitive : Qt::CaseInsensitive );
|
||||
return new ParseTreeIN( static_cast<ParseTreeBase*>(_ptr1), static_cast<ParseTreeBase*>(_ptr2),
|
||||
_cs == 1 ? Qt::CaseSensitive : Qt::CaseInsensitive );
|
||||
}
|
||||
|
||||
void* KTraderParse_newSubstringIN( void *_ptr1, void *_ptr2, int _cs )
|
||||
{
|
||||
return new ParseTreeIN((ParseTreeBase*)_ptr1, (ParseTreeBase*)_ptr2,
|
||||
return new ParseTreeIN(static_cast<ParseTreeBase*>(_ptr1), static_cast<ParseTreeBase*>(_ptr2),
|
||||
_cs == 1 ? Qt::CaseSensitive : Qt::CaseInsensitive, true);
|
||||
}
|
||||
|
||||
void* KTraderParse_newMATCH( void *_ptr1, void *_ptr2, int _cs )
|
||||
{
|
||||
return new ParseTreeMATCH( (ParseTreeBase*)_ptr1, (ParseTreeBase*)_ptr2, _cs == 1 ? Qt::CaseSensitive : Qt::CaseInsensitive );
|
||||
return new ParseTreeMATCH( static_cast<ParseTreeBase*>(_ptr1), static_cast<ParseTreeBase*>(_ptr2), _cs == 1 ? Qt::CaseSensitive : Qt::CaseInsensitive );
|
||||
}
|
||||
|
||||
void* KTraderParse_newCALC( void *_ptr1, void *_ptr2, int _i )
|
||||
{
|
||||
return new ParseTreeCALC( (ParseTreeBase*)_ptr1, (ParseTreeBase*)_ptr2, _i );
|
||||
return new ParseTreeCALC( static_cast<ParseTreeBase*>(_ptr1), static_cast<ParseTreeBase*>(_ptr2), _i );
|
||||
}
|
||||
|
||||
void* KTraderParse_newBRACKETS( void *_ptr1 )
|
||||
{
|
||||
return new ParseTreeBRACKETS( (ParseTreeBase*)_ptr1 );
|
||||
return new ParseTreeBRACKETS( static_cast<ParseTreeBase*>(_ptr1) );
|
||||
}
|
||||
|
||||
void* KTraderParse_newNOT( void *_ptr1 )
|
||||
{
|
||||
return new ParseTreeNOT( (ParseTreeBase*)_ptr1 );
|
||||
return new ParseTreeNOT( static_cast<ParseTreeBase*>(_ptr1) );
|
||||
}
|
||||
|
||||
void* KTraderParse_newEXIST( char *_ptr1 )
|
||||
|
|
|
@ -135,10 +135,6 @@ QString Loader::languageNameForCode(const QString &langCode) const
|
|||
localizedCountry; // localized country
|
||||
QByteArray variantEnglish; // dictionary variant in English
|
||||
|
||||
int underscorePos, // position of "_" char
|
||||
minusPos, // position of "-" char
|
||||
variantCount = 0; // used to iterate over variantList
|
||||
|
||||
struct variantListType
|
||||
{
|
||||
const char* variantShortName;
|
||||
|
@ -170,8 +166,8 @@ QString Loader::languageNameForCode(const QString &langCode) const
|
|||
{ 0, 0 }
|
||||
};
|
||||
|
||||
minusPos = currentDictionary.indexOf(QLatin1Char('-'));
|
||||
underscorePos = currentDictionary.indexOf(QLatin1Char('_'));
|
||||
const int minusPos = currentDictionary.indexOf(QLatin1Char('-'));
|
||||
const int underscorePos = currentDictionary.indexOf(QLatin1Char('_'));
|
||||
if (underscorePos != -1 && underscorePos <= 3) {
|
||||
cISOName = currentDictionary.mid(underscorePos + 1, 2);
|
||||
lISOName = currentDictionary.left(underscorePos);
|
||||
|
@ -197,6 +193,7 @@ QString Loader::languageNameForCode(const QString &langCode) const
|
|||
localizedCountry = cISOName;
|
||||
}
|
||||
if (!variantName.isEmpty()) {
|
||||
int variantCount = 0;
|
||||
while (variantList[variantCount].variantShortName != 0)
|
||||
if (QLatin1String(variantList[variantCount].variantShortName) == variantName)
|
||||
break;
|
||||
|
|
|
@ -201,9 +201,8 @@ int main()
|
|||
#ifndef QWS
|
||||
char xauthority[200];
|
||||
#endif
|
||||
int i/*, res, sycoca*/, prio;
|
||||
int i/*, res, sycoca*/;
|
||||
pid_t pid;
|
||||
FILE *fout;
|
||||
struct passwd *pw;
|
||||
const char* kdesu_lc_all;
|
||||
|
||||
|
@ -273,24 +272,23 @@ int main()
|
|||
unsetenv("DBUS_SESSION_BUS_ADDRESS");
|
||||
|
||||
/* Set scheduling/priority */
|
||||
|
||||
prio = atoi(params[P_PRIORITY].value);
|
||||
if (!strcmp(params[P_SCHEDULER].value, "realtime"))
|
||||
{
|
||||
#ifdef POSIX1B_SCHEDULING
|
||||
struct sched_param sched;
|
||||
int min = sched_get_priority_min(SCHED_FIFO);
|
||||
int max = sched_get_priority_max(SCHED_FIFO);
|
||||
sched.sched_priority = min + (int) (((double) prio) * (max - min) / 100 + 0.5);
|
||||
sched_setscheduler(0, SCHED_FIFO, &sched);
|
||||
#else
|
||||
printf("kdesu_stub: realtime scheduling not supported\n");
|
||||
#if defined(POSIX1B_SCHEDULING) || defined(HAVE_SETPRIORITY)
|
||||
double prio = (double) atoi(params[P_PRIORITY].value);
|
||||
#endif
|
||||
if (!strcmp(params[P_SCHEDULER].value, "realtime")) {
|
||||
#ifdef POSIX1B_SCHEDULING
|
||||
struct sched_param sched;
|
||||
int min = sched_get_priority_min(SCHED_FIFO);
|
||||
int max = sched_get_priority_max(SCHED_FIFO);
|
||||
sched.sched_priority = min + (int) (prio * (max - min) / 100 + 0.5);
|
||||
sched_setscheduler(0, SCHED_FIFO, &sched);
|
||||
#else
|
||||
printf("kdesu_stub: realtime scheduling not supported\n");
|
||||
#endif
|
||||
} else
|
||||
{
|
||||
#ifdef HAVE_SETPRIORITY
|
||||
int val = 20 - (int) (((double) prio) * 40 / 100 + 0.5);
|
||||
setpriority(PRIO_PROCESS, getpid(), val);
|
||||
} else {
|
||||
int val = 20 - (int) (prio * 40 / 100 + 0.5);
|
||||
setpriority(PRIO_PROCESS, getpid(), val);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -348,7 +346,7 @@ int main()
|
|||
close(fd2);
|
||||
xsetenv("XAUTHORITY", xauthority);
|
||||
|
||||
fout = popen("xauth >/dev/null 2>&1","w");
|
||||
FILE *fout = popen("xauth >/dev/null 2>&1","w");
|
||||
if (fout == NULL)
|
||||
{
|
||||
perror("kdesu_stub: popen(xauth)");
|
||||
|
@ -381,10 +379,11 @@ int main()
|
|||
if (pid)
|
||||
{
|
||||
/* Parent: wait for child, delete tempfiles and return. */
|
||||
int ret, state, xit = 1;
|
||||
int xit = 1;
|
||||
while (1)
|
||||
{
|
||||
ret = waitpid(pid, &state, 0);
|
||||
int state;
|
||||
int ret = waitpid(pid, &state, 0);
|
||||
if (ret == -1)
|
||||
{
|
||||
if (errno == EINTR)
|
||||
|
|
|
@ -240,11 +240,10 @@ QByteArray PtyProcess::readLine(bool block)
|
|||
{
|
||||
d->m_Inbuf = readAll(block);
|
||||
|
||||
int pos;
|
||||
QByteArray ret;
|
||||
if (!d->m_Inbuf.isEmpty())
|
||||
{
|
||||
pos = d->m_Inbuf.indexOf('\n');
|
||||
int pos = d->m_Inbuf.indexOf('\n');
|
||||
if (pos == -1)
|
||||
{
|
||||
// NOTE: this means we return something even if there in no full line!
|
||||
|
@ -291,7 +290,6 @@ void PtyProcess::setExitString(const QByteArray &exit)
|
|||
int PtyProcess::exec(const QByteArray &command, const QList<QByteArray> &args)
|
||||
{
|
||||
kDebug(kdesuDebugArea()) << "Running" << command;
|
||||
int i;
|
||||
|
||||
if (init() < 0)
|
||||
return -1;
|
||||
|
@ -313,7 +311,7 @@ int PtyProcess::exec(const QByteArray &command, const QList<QByteArray> &args)
|
|||
if (setupTTY() < 0)
|
||||
_exit(1);
|
||||
|
||||
for (i = 0; i < d->env.count(); ++i)
|
||||
for (int i = 0; i < d->env.count(); ++i)
|
||||
{
|
||||
putenv(const_cast<char *>(d->env.at(i).constData()));
|
||||
}
|
||||
|
@ -335,13 +333,11 @@ int PtyProcess::exec(const QByteArray &command, const QList<QByteArray> &args)
|
|||
// From now on, terminal output goes through the tty.
|
||||
|
||||
QByteArray path;
|
||||
if (command.contains('/'))
|
||||
if (command.contains('/')) {
|
||||
path = command;
|
||||
else
|
||||
{
|
||||
} else {
|
||||
QString file = KStandardDirs::findExe(command);
|
||||
if (file.isEmpty())
|
||||
{
|
||||
if (file.isEmpty()) {
|
||||
kError(kdesuDebugArea()) << command << "not found.";
|
||||
_exit(1);
|
||||
}
|
||||
|
@ -349,12 +345,12 @@ int PtyProcess::exec(const QByteArray &command, const QList<QByteArray> &args)
|
|||
}
|
||||
|
||||
const char **argp = (const char **)malloc((args.count()+2)*sizeof(char *));
|
||||
|
||||
i = 0;
|
||||
argp[i++] = path;
|
||||
for (QList<QByteArray>::ConstIterator it=args.begin(); it!=args.end(); ++it, ++i)
|
||||
argp[i] = *it;
|
||||
|
||||
int i = 1;
|
||||
argp[i] = path;
|
||||
foreach (QByteArray it, args) {
|
||||
argp[i] = it;
|
||||
i++;
|
||||
}
|
||||
argp[i] = NULL;
|
||||
|
||||
execv(path, const_cast<char **>(argp));
|
||||
|
|
|
@ -66,7 +66,6 @@
|
|||
int main (int argc, char *argv[])
|
||||
{
|
||||
struct stat st;
|
||||
struct group* p;
|
||||
gid_t gid;
|
||||
uid_t uid;
|
||||
mode_t mod;
|
||||
|
@ -156,18 +155,21 @@ int main (int argc, char *argv[])
|
|||
if (memcmp(pty,"/dev/pty",8))
|
||||
{
|
||||
fprintf(stderr,"%s: determined a strange pty name '%s'.\n",argv[0],pty);
|
||||
free(pty);
|
||||
return 1; /* FAIL */
|
||||
}
|
||||
|
||||
tty = malloc(strlen(pty) + 1);
|
||||
strcpy(tty,"/dev/tty");
|
||||
strcat(tty,pty+8);
|
||||
free(pty);
|
||||
}
|
||||
|
||||
/* Check that the returned slave pseudo terminal is a character device. */
|
||||
if (stat(tty, &st) < 0 || !S_ISCHR(st.st_mode))
|
||||
{
|
||||
fprintf(stderr,"%s: found '%s' not to be a character device.\n",argv[0],tty);
|
||||
free(tty);
|
||||
return 1; /* FAIL */
|
||||
}
|
||||
|
||||
|
@ -176,7 +178,7 @@ int main (int argc, char *argv[])
|
|||
if (!strcmp(argv[1],"--grant"))
|
||||
{
|
||||
uid = getuid();
|
||||
p = getgrnam(TTY_GROUP);
|
||||
struct group* p = getgrnam(TTY_GROUP);
|
||||
if (!p)
|
||||
p = getgrnam("wheel");
|
||||
gid = p ? p->gr_gid : getgid ();
|
||||
|
@ -194,14 +196,17 @@ int main (int argc, char *argv[])
|
|||
if (chown(tty, uid, gid) < 0)
|
||||
{
|
||||
fprintf(stderr,"%s: cannot chown %s: %s\n",argv[0],tty,strerror(errno));
|
||||
free(tty);
|
||||
return 1; /* FAIL */
|
||||
}
|
||||
|
||||
if (chmod(tty, mod) < 0)
|
||||
{
|
||||
fprintf(stderr,"%s: cannot chmod %s: %s\n",argv[0],tty,strerror(errno));
|
||||
free(tty);
|
||||
return 1; /* FAIL */
|
||||
}
|
||||
|
||||
free(tty);
|
||||
return 0; /* OK */
|
||||
}
|
||||
|
|
|
@ -265,13 +265,13 @@ public:
|
|||
|
||||
void checkTearDown()
|
||||
{
|
||||
//kDebug() << prepped << teardownRequested << searchJobs.count();
|
||||
//kDebug() << prepped << teardownRequested << threadPool.activeThreadCount();
|
||||
|
||||
if (!prepped || !teardownRequested) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (searchJobs.isEmpty()) {
|
||||
if (threadPool.activeThreadCount() <= 0) {
|
||||
if (allRunnersPrepped) {
|
||||
foreach (AbstractRunner *runner, runners) {
|
||||
emit runner->teardown();
|
||||
|
@ -312,7 +312,6 @@ public:
|
|||
{
|
||||
if ((runner->ignoredTypes() & context.type()) == 0) {
|
||||
FindMatchesJob *job = new FindMatchesJob(runner, &context);
|
||||
searchJobs.insert(job);
|
||||
threadPool->start(job);
|
||||
}
|
||||
}
|
||||
|
@ -323,7 +322,6 @@ public:
|
|||
QHash<QString, AbstractRunner*> runners;
|
||||
QHash<QString, QString> advertiseSingleRunnerIds;
|
||||
AbstractRunner* currentSingleRunner;
|
||||
QSet<FindMatchesJob*> searchJobs;
|
||||
QThreadPool *threadPool;
|
||||
KConfigGroup conf;
|
||||
QString singleModeRunnerId;
|
||||
|
@ -691,7 +689,6 @@ QString RunnerManager::query() const
|
|||
void RunnerManager::reset()
|
||||
{
|
||||
d->threadPool->waitForDone(3000);
|
||||
d->searchJobs.clear();
|
||||
|
||||
d->context.reset();
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue