Version 2.8
We use QWinWidget to embed our Widget into another Windows application. In one of our use cases the Widget loses the focus. In this case the function focusWidget() of QWinWidget returns null.
This leads to a crash in QWinWidget::focusNextPrevChild(). The first thing that function does is calling focusWidget(). The retrieved pointer is afterward used without checking. To solve this, all you have to do is checking the pointer retrieved from focusWidget.
The following fix solved the problem for us:
bool QWinWidget::focusNextPrevChild(bool next)
QWidget *curFocus = focusWidget();
if
(0 != curFocus) {
if
(!next) {
if
(!curFocus->isWindow()) {
QWidget *nextFocus = curFocus->nextInFocusChain();
QWidget *prevFocus = 0;
QWidget *topLevel = 0;
while
(nextFocus != curFocus) {
if
(nextFocus->focusPolicy() & Qt::TabFocus) {
prevFocus = nextFocus;
topLevel = 0;
}
else
if
(nextFocus->isWindow()) {
topLevel = nextFocus;
nextFocus = nextFocus->nextInFocusChain();
if
(!topLevel) {
return
QWidget::focusNextPrevChild(
false
);
}
else
{
QWidget *nextFocus = curFocus;
while
(1) {
nextFocus = nextFocus->nextInFocusChain();
if
(nextFocus->isWindow())
break
;
if
(nextFocus->focusPolicy() & Qt::TabFocus) {
return
QWidget::focusNextPrevChild(
true
);
::SetFocus(hParent);
return
true
;
No reviews matched the request. Check your Options in the drop-down menu of this sections header.