pidgin/quail/quail-redux

12e52b5b1d53
Parents 41ce47a8e50b
Children f545504ba1e1
Correct my broken experiment with the event loop
--- a/Quail-redux.pro Wed Oct 09 11:53:08 2013 +0100
+++ b/Quail-redux.pro Sat Nov 30 08:14:26 2013 +0000
@@ -55,7 +55,8 @@
CONFIG += debug_and_release
CONFIG += link_pkgconfig
PKGCONFIG += purple glib-2.0 gmodule-2.0
-
+ INCLUDEPATH += "$(LIBPURPLE_ROOT)"
+ LIBS += -L"$(LIBPURPLE_ROOT)/libpurple"
}
win32-g++* {
--- a/src/QuailEventLoop.cpp Wed Oct 09 11:53:08 2013 +0100
+++ b/src/QuailEventLoop.cpp Sat Nov 30 08:14:26 2013 +0000
@@ -45,10 +45,9 @@
//static QThread *quailThread = new QThread();
QQuailTimer::QQuailTimer(guint sourceId, GSourceFunc func, gpointer data)
- : QTimer(0), sourceId(sourceId), func(func), userData(data)
+ : QTimer(), sourceId(sourceId), func(func), userData(data)
{
//qDebug() << "QQuailTimer::QQuailTimer.1";
-// this->setSingleShot(true);
connect(this, SIGNAL(timeout()),
this, SLOT(update()));
}
@@ -137,11 +136,8 @@
{
qDebug() << "qQuailTimeoutAdd" << interval;
QQuailSourceInfo *info = new QQuailSourceInfo;
-
info->handle = nextSourceId++;
-
info->timer = new QQuailTimer(info->handle, func, data);
- //info->timer->moveToThread(quailThread);
m_sources.insert(info->handle, info);
info->timer->start(interval);
return info->handle;
@@ -168,7 +164,6 @@
info->handle = nextSourceId++;
info->notifier = new QQuailInputNotifier(fd, cond, func, userData);
-
m_sources.insert(info->handle, info);
qDebug() << "QQuailInputNotifier::qQuailInputAdd.end::" << info->handle;
qDebug() << "QQuailInputNotifier::qQuailInputAdd.end::" << m_sources.size();
@@ -178,21 +173,19 @@
static gboolean
qQuailSourceRemove(guint handle)
{
- qDebug() << "QQuailInputNotifier::qQuailSourceRemove";
QQuailSourceInfo *info;
- info = m_sources.value(handle);
-
+ info = m_sources.take(handle);
if (info == NULL)
return false;
- m_sources.remove(handle);
-
- if (info->timer != NULL)
+ if (info->timer != NULL) {
delete info->timer;
- else if (info->notifier != NULL)
+ info->timer = NULL;
+ } else if (info->notifier != NULL) {
delete info->notifier;
-
+ info->notifier = NULL;
+ }
delete info;
return true;
}