summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAndreas Buhr <andreas.buhr@qt.io>2020-10-16 16:27:14 +0200
committerAndreas Buhr <andreas.buhr@qt.io>2020-10-22 00:51:26 +0200
commit5872a89474f632188b650d3d2d13193a3c624049 (patch)
tree836a52c5b90240a59ba2a6aa788d5f765094ce57 /src
parentff776a3059b25f8dd3c3abbd6aa8ffa95ec9cf7a (diff)
name our glib event sources to ease debugging
glib event sources can have a name, but it is not required. Internal to glib, it is common to give them a name, see for example https://git.io/JTZ8g . This patch gives a name to each glib event source created in qtbase. Task-number: QTBUG-84291 Change-Id: I4f04526dcec082242312e3a66da2adf37a22e626 Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
Diffstat (limited to 'src')
-rw-r--r--src/corelib/kernel/qeventdispatcher_glib.cpp22
-rw-r--r--src/gui/platform/unix/qeventdispatcher_glib.cpp7
-rw-r--r--src/plugins/platforms/xcb/qxcbeventdispatcher.cpp5
3 files changed, 21 insertions, 13 deletions
diff --git a/src/corelib/kernel/qeventdispatcher_glib.cpp b/src/corelib/kernel/qeventdispatcher_glib.cpp
index 4efdcf4cc6..59c937362b 100644
--- a/src/corelib/kernel/qeventdispatcher_glib.cpp
+++ b/src/corelib/kernel/qeventdispatcher_glib.cpp
@@ -318,32 +318,36 @@ QEventDispatcherGlibPrivate::QEventDispatcherGlibPrivate(GMainContext *context)
#endif
// setup post event source
- postEventSource = reinterpret_cast<GPostEventSource *>(g_source_new(&postEventSourceFuncs,
- sizeof(GPostEventSource)));
+ GSource *source = g_source_new(&postEventSourceFuncs, sizeof(GPostEventSource));
+ g_source_set_name(source, "[Qt] GPostEventSource");
+ postEventSource = reinterpret_cast<GPostEventSource *>(source);
+
postEventSource->serialNumber.storeRelaxed(1);
postEventSource->d = this;
g_source_set_can_recurse(&postEventSource->source, true);
g_source_attach(&postEventSource->source, mainContext);
// setup socketNotifierSource
- socketNotifierSource =
- reinterpret_cast<GSocketNotifierSource *>(g_source_new(&socketNotifierSourceFuncs,
- sizeof(GSocketNotifierSource)));
+ source = g_source_new(&socketNotifierSourceFuncs, sizeof(GSocketNotifierSource));
+ g_source_set_name(source, "[Qt] GSocketNotifierSource");
+ socketNotifierSource = reinterpret_cast<GSocketNotifierSource *>(source);
(void) new (&socketNotifierSource->pollfds) QList<GPollFDWithQSocketNotifier *>();
g_source_set_can_recurse(&socketNotifierSource->source, true);
g_source_attach(&socketNotifierSource->source, mainContext);
// setup normal and idle timer sources
- timerSource = reinterpret_cast<GTimerSource *>(g_source_new(&timerSourceFuncs,
- sizeof(GTimerSource)));
+ source = g_source_new(&timerSourceFuncs, sizeof(GTimerSource));
+ g_source_set_name(source, "[Qt] GTimerSource");
+ timerSource = reinterpret_cast<GTimerSource *>(source);
(void) new (&timerSource->timerList) QTimerInfoList();
timerSource->processEventsFlags = QEventLoop::AllEvents;
timerSource->runWithIdlePriority = false;
g_source_set_can_recurse(&timerSource->source, true);
g_source_attach(&timerSource->source, mainContext);
- idleTimerSource = reinterpret_cast<GIdleTimerSource *>(g_source_new(&idleTimerSourceFuncs,
- sizeof(GIdleTimerSource)));
+ source = g_source_new(&idleTimerSourceFuncs, sizeof(GIdleTimerSource));
+ g_source_set_name(source, "[Qt] GIdleTimerSource");
+ idleTimerSource = reinterpret_cast<GIdleTimerSource *>(source);
idleTimerSource->timerSource = timerSource;
g_source_set_can_recurse(&idleTimerSource->source, true);
g_source_attach(&idleTimerSource->source, mainContext);
diff --git a/src/gui/platform/unix/qeventdispatcher_glib.cpp b/src/gui/platform/unix/qeventdispatcher_glib.cpp
index eaa27de25c..bf9e31990e 100644
--- a/src/gui/platform/unix/qeventdispatcher_glib.cpp
+++ b/src/gui/platform/unix/qeventdispatcher_glib.cpp
@@ -88,8 +88,11 @@ QPAEventDispatcherGlibPrivate::QPAEventDispatcherGlibPrivate(GMainContext *conte
: QEventDispatcherGlibPrivate(context)
{
Q_Q(QPAEventDispatcherGlib);
- userEventSource = reinterpret_cast<GUserEventSource *>(g_source_new(&userEventSourceFuncs,
- sizeof(GUserEventSource)));
+
+ GSource *source = g_source_new(&userEventSourceFuncs, sizeof(GUserEventSource));
+ g_source_set_name(source, "[Qt] GUserEventSource");
+ userEventSource = reinterpret_cast<GUserEventSource *>(source);
+
userEventSource->q = q;
userEventSource->d = this;
g_source_set_can_recurse(&userEventSource->source, true);
diff --git a/src/plugins/platforms/xcb/qxcbeventdispatcher.cpp b/src/plugins/platforms/xcb/qxcbeventdispatcher.cpp
index 5055057db9..68259ff238 100644
--- a/src/plugins/platforms/xcb/qxcbeventdispatcher.cpp
+++ b/src/plugins/platforms/xcb/qxcbeventdispatcher.cpp
@@ -104,8 +104,9 @@ QXcbGlibEventDispatcher::QXcbGlibEventDispatcher(QXcbConnection *connection, QOb
m_xcbEventSourceFuncs.dispatch = xcbSourceDispatch;
m_xcbEventSourceFuncs.finalize = nullptr;
- m_xcbEventSource = reinterpret_cast<XcbEventSource *>(
- g_source_new(&m_xcbEventSourceFuncs, sizeof(XcbEventSource)));
+ GSource *source = g_source_new(&m_xcbEventSourceFuncs, sizeof(XcbEventSource));
+ g_source_set_name(source, "[Qt] XcbEventSource");
+ m_xcbEventSource = reinterpret_cast<XcbEventSource *>(source);
m_xcbEventSource->dispatcher = this;
m_xcbEventSource->dispatcher_p = d_func();