diff options
author | Miikka Heikkinen <miikka.heikkinen@digia.com> | 2012-07-05 11:06:04 +0300 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2012-07-05 12:27:42 +0200 |
commit | a3ca652b8f81999235db6a595f38adfbd499a42d (patch) | |
tree | 63eec495182403915af69812e2a363eaaeb69b30 /src | |
parent | f4fb6abcc5bda601881b846613eb882b5a2db94d (diff) | |
download | qtactiveqt-a3ca652b8f81999235db6a595f38adfbd499a42d.tar.gz |
Fix assert with when ActiveQt server changes status bar text.
QAxServerBase has a custom implementation of qt_metacall() to convert
any signals generated by the server to COM events. However,
QStatusBar::messageChanged() signal has a custom handling where it
doesn't generate a COM event for it but instead directly modifies the
status bar of the application. This special case was detected by
connecting the signal to slot '-1' and then intercepting signals to
that slot in qt_metacall(). However, somewhere along the way
signal/slot internals have changed so that unsigned shorts are used
for slot indexes, which meant qt_metacall() got signal for slot 65535
instead of -1 and therefore didn't properly intercept messageChanged().
Fixed by changing the custom slot index to one that will not get
mangled by int to unsigned short conversions.
Task-number: QTBUG-26422
Change-Id: I889cb19d1569425ff157a9d897de1cbb4a3f02b6
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@nokia.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/activeqt/control/qaxserverbase.cpp | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/activeqt/control/qaxserverbase.cpp b/src/activeqt/control/qaxserverbase.cpp index 08fbda2..cfc47e8 100644 --- a/src/activeqt/control/qaxserverbase.cpp +++ b/src/activeqt/control/qaxserverbase.cpp @@ -80,6 +80,10 @@ #define ULONG_PTR DWORD #endif +// Statusbar messageChanged() signal is connected to a fake slot +// that is custom handled in qt_metacall. Index needs to fit to ushort. +#define STATUSBAR_MESSAGE_CHANGED_SLOT_INDEX 60000 + QT_BEGIN_NAMESPACE extern HHOOK qax_hhook; @@ -1892,7 +1896,7 @@ int QAxServerBase::qt_metacall(QMetaObject::Call call, int index, void **argv) { Q_ASSERT(call == QMetaObject::InvokeMetaMethod); - if (index == -1) { + if (index == STATUSBAR_MESSAGE_CHANGED_SLOT_INDEX) { if (sender() && m_spInPlaceFrame) { if (qobject_cast<QStatusBar*>(sender()) != statusBar) return true; @@ -3425,7 +3429,7 @@ HRESULT WINAPI QAxServerBase::UIDeactivate() if (statusBar) { statusBar->removeEventFilter(this); const int index = statusBar->metaObject()->indexOfSignal("messageChanged(QString)"); - QMetaObject::disconnect(statusBar, index, this, -1); + QMetaObject::disconnect(statusBar, index, this, STATUSBAR_MESSAGE_CHANGED_SLOT_INDEX); statusBar = 0; } m_spInPlaceFrame->SetActiveObject(0, 0); @@ -3825,7 +3829,7 @@ HRESULT QAxServerBase::internalActivate() statusBar = qt.widget ? qt.widget->findChild<QStatusBar*>() : 0; if (statusBar && !statusBar->isVisible()) { const int index = statusBar->metaObject()->indexOfSignal("messageChanged(QString)"); - QMetaObject::connect(statusBar, index, this, -1); + QMetaObject::connect(statusBar, index, this, STATUSBAR_MESSAGE_CHANGED_SLOT_INDEX); statusBar->hide(); statusBar->installEventFilter(this); } |