Permalink
Browse files

Some debug prints removed. Timeout for Systray to load increased to 1…

… minute. Module crash detection improved.
  • Loading branch information...
1 parent b0b6a30 commit e3e3dab4d9e056937918ad523f43bf79128481b4 @kuzmas kuzmas committed Dec 1, 2012
@@ -118,11 +118,11 @@ CommandProvider::CommandProvider():
************************************************/
CommandProvider::~CommandProvider()
{
- qDebug() << "*****************************************";
- qDebug() << hex << this;
- qDebug() << "DESTROY";
+// qDebug() << "*****************************************";
+// qDebug() << hex << this;
+// qDebug() << "DESTROY";
qDeleteAll(*this);
- qDebug() << "*****************************************";
+// qDebug() << "*****************************************";
}
@@ -148,12 +148,12 @@ AppLinkItem::AppLinkItem(const QDomElement &element):
************************************************/
void AppLinkItem::updateIcon()
{
- qDebug() << "*****************************************";
- qDebug() << hex << this;
- qDebug() << Q_FUNC_INFO;
+// qDebug() << "*****************************************";
+// qDebug() << hex << this;
+// qDebug() << Q_FUNC_INFO;
if (mIcon.isNull())
mIcon = XdgIcon::fromTheme(mIconName);
- qDebug() << "*****************************************";
+// qDebug() << "*****************************************";
}
@@ -98,7 +98,7 @@ void RazorModuleManager::startup()
int waitCnt = 300;
while (!xfitMan().isWindowManagerActive() && waitCnt)
{
- qDebug() << "******************** Wait until the WM loads" << waitCnt;
+// qDebug() << "******************** Wait until the WM loads" << waitCnt;
waitCnt--;
usleep(100000);
}
@@ -117,10 +117,10 @@ void RazorModuleManager::startup()
if (!trayApps.isEmpty())
{
- int waitCnt = 200;
+ int waitCnt = 600;
while (!QSystemTrayIcon::isSystemTrayAvailable())
{
- qDebug() << "******************** Wait for tray" << waitCnt;
+// qDebug() << "******************** Wait for tray" << waitCnt;
if (!waitCnt)
{
qWarning() << "******************** No systray implementation started in session. Continuing.";
@@ -133,9 +133,6 @@ void RazorModuleManager::startup()
foreach (XdgDesktopFile* f, trayApps)
startProcess(*f);
}
-
- m_crashTimer.setInterval(60000);
- connect(&m_crashTimer, SIGNAL(timeout()), this, SLOT(resetCrashReport()));
}
void RazorModuleManager::startProcess(const XdgDesktopFile& file)
@@ -212,14 +209,14 @@ void RazorModuleManager::restartModules(int exitCode, QProcess::ExitStatus exitS
case QProcess::CrashExit:
{
qDebug() << "Process" << procName << "(" << proc << ") has to be restarted";
- if (!m_crashReport.contains(proc))
- m_crashReport[proc] = 0;
- int stat = m_crashReport[proc]++;
- if (stat >= MAX_CRASHES_PER_APP)
+ time_t now = time(NULL);
+ mCrashReport[proc].prepend(now);
+ while (now - mCrashReport[proc].back() > 60)
+ mCrashReport[proc].pop_back();
+ if (mCrashReport[proc].length() >= MAX_CRASHES_PER_APP)
{
QMessageBox::warning(0, tr("Razor Session Crash Report"),
tr("Application '%1' crashed too many times. Its autorestart has been disabled for current session.").arg(procName));
-
}
else
{
@@ -290,7 +287,7 @@ QString RazorModuleManager::showWmSelectDialog()
void RazorModuleManager::resetCrashReport()
{
- m_crashReport.clear();
+ mCrashReport.clear();
}
void razor_setenv(const char *env, const QByteArray &value)
@@ -29,15 +29,19 @@
#define RAZORMODMAN_H
#include <QtCore/QProcess>
+#include <QtCore/QList>
#include <QtCore/QMap>
#include <QtCore/QTimer>
#include <qtxdg/xdgdesktopfile.h>
+#include <time.h>
+
class RazorModule;
typedef QMap<QString,RazorModule*> ModulesMap;
typedef QMapIterator<QString,RazorModule*> ModulesMapIterator;
-typedef QMap<QProcess*,int> ModulesCrashReport;
+typedef QList<time_t> ModuleCrashReport;
+typedef QMap<QProcess*, ModuleCrashReport> ModulesCrashReport;
/*! \brief RazorModuleManager manages the processes of the session
and which modules of razor are about to load.
@@ -112,8 +116,7 @@ public slots:
/*! \brief Keep creashes for given process to raise a message in the
case of repeating crashes
*/
- ModulesCrashReport m_crashReport;
- QTimer m_crashTimer;
+ ModulesCrashReport mCrashReport;
private slots:

0 comments on commit e3e3dab

Please sign in to comment.