summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/corelib/codecs/qtextcodec.cpp39
-rw-r--r--src/corelib/codecs/qtextcodec.h5
-rw-r--r--src/corelib/kernel/qcoreapplication.cpp22
-rw-r--r--src/gui/dialogs/qfiledialog.ui36
-rw-r--r--src/gui/graphicsview/qgraphicsproxywidget.cpp2
-rw-r--r--src/gui/graphicsview/qgraphicswidget.cpp4
-rw-r--r--src/gui/image/qimage.cpp3
-rw-r--r--src/gui/image/qimagewriter.cpp1
-rw-r--r--src/gui/itemviews/qtableview.cpp9
-rw-r--r--src/gui/kernel/qapplication_s60.cpp12
-rw-r--r--src/gui/kernel/qsoftkeymanager_s60.cpp35
-rw-r--r--src/gui/kernel/qsoftkeymanager_s60_p.h1
-rw-r--r--src/gui/kernel/qt_s60_p.h1
-rw-r--r--src/gui/kernel/qwidget.cpp8
-rw-r--r--src/gui/text/qtextcontrol.cpp6
-rw-r--r--src/gui/widgets/qmenu.cpp14
-rw-r--r--src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp2
-rw-r--r--src/opengl/gl2paintengineex/qtriangulatingstroker.cpp16
-rw-r--r--src/openvg/qwindowsurface_vgegl.cpp24
-rw-r--r--src/plugins/accessible/widgets/complexwidgets.cpp3
20 files changed, 192 insertions, 51 deletions
diff --git a/src/corelib/codecs/qtextcodec.cpp b/src/corelib/codecs/qtextcodec.cpp
index 72b0128..59a601e 100644
--- a/src/corelib/codecs/qtextcodec.cpp
+++ b/src/corelib/codecs/qtextcodec.cpp
@@ -110,6 +110,7 @@ Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, loader,
(QTextCodecFactoryInterface_iid, QLatin1String("/codecs")))
#endif
+
static char qtolower(register char c)
{ if (c >= 'A' && c <= 'Z') return c + 0x20; return c; }
static bool qisalnum(register char c)
@@ -224,6 +225,19 @@ QTextCodecCleanup::~QTextCodecCleanup()
Q_GLOBAL_STATIC(QTextCodecCleanup, createQTextCodecCleanup)
+bool QTextCodec::validCodecs()
+{
+#ifdef Q_OS_SYMBIAN
+ // If we don't have a trap handler, we're outside of the main() function,
+ // ie. in global constructors or destructors. Don't use codecs in this
+ // case as it would lead to crashes because we don't have a cleanup stack on Symbian
+ return (User::TrapHandler() != NULL);
+#else
+ return true;
+#endif
+}
+
+
#if defined(Q_OS_WIN32) || defined(Q_OS_WINCE)
class QWindowsLocalCodec: public QTextCodec
{
@@ -710,6 +724,14 @@ static void setup()
if (all)
return;
+#ifdef Q_OS_SYMBIAN
+ // If we don't have a trap handler, we're outside of the main() function,
+ // ie. in global constructors or destructors. Don't create codecs in this
+ // case as it would lead to crashes because of a missing cleanup stack on Symbian
+ if (User::TrapHandler() == NULL)
+ return;
+#endif
+
#ifdef Q_DEBUG_TEXTCODEC
if (destroying_is_ok)
qWarning("QTextCodec: Creating new codec during codec cleanup");
@@ -1012,6 +1034,9 @@ QTextCodec *QTextCodec::codecForName(const QByteArray &name)
#endif
setup();
+ if (!validCodecs())
+ return 0;
+
static QHash <QByteArray, QTextCodec *> cache;
if (clearCaches & 0x1) {
cache.clear();
@@ -1053,6 +1078,9 @@ QTextCodec* QTextCodec::codecForMib(int mib)
#endif
setup();
+ if (!validCodecs())
+ return 0;
+
static QHash <int, QTextCodec *> cache;
if (clearCaches & 0x2) {
cache.clear();
@@ -1100,6 +1128,10 @@ QList<QByteArray> QTextCodec::availableCodecs()
setup();
QList<QByteArray> codecs;
+
+ if (!validCodecs())
+ return codecs;
+
for (int i = 0; i < all->size(); ++i) {
codecs += all->at(i)->name();
codecs += all->at(i)->aliases();
@@ -1138,6 +1170,10 @@ QList<int> QTextCodec::availableMibs()
setup();
QList<int> codecs;
+
+ if (!validCodecs())
+ return codecs;
+
for (int i = 0; i < all->size(); ++i)
codecs += all->at(i)->mibEnum();
@@ -1191,6 +1227,9 @@ void QTextCodec::setCodecForLocale(QTextCodec *c)
QTextCodec* QTextCodec::codecForLocale()
{
+ if (!validCodecs())
+ return 0;
+
if (localeMapper)
return localeMapper;
diff --git a/src/corelib/codecs/qtextcodec.h b/src/corelib/codecs/qtextcodec.h
index e37527d..4ba8b85 100644
--- a/src/corelib/codecs/qtextcodec.h
+++ b/src/corelib/codecs/qtextcodec.h
@@ -148,12 +148,13 @@ public:
private:
friend class QTextCodecCleanup;
static QTextCodec *cftr;
+ static bool validCodecs();
};
Q_DECLARE_OPERATORS_FOR_FLAGS(QTextCodec::ConversionFlags)
-inline QTextCodec* QTextCodec::codecForTr() { return cftr; }
+ inline QTextCodec* QTextCodec::codecForTr() { return validCodecs() ? cftr : 0; }
inline void QTextCodec::setCodecForTr(QTextCodec *c) { cftr = c; }
-inline QTextCodec* QTextCodec::codecForCStrings() { return QString::codecForCStrings; }
+inline QTextCodec* QTextCodec::codecForCStrings() { return validCodecs() ? QString::codecForCStrings : 0; }
inline void QTextCodec::setCodecForCStrings(QTextCodec *c) { QString::codecForCStrings = c; }
class Q_CORE_EXPORT QTextEncoder {
diff --git a/src/corelib/kernel/qcoreapplication.cpp b/src/corelib/kernel/qcoreapplication.cpp
index 8fc3fb8..1a1f978 100644
--- a/src/corelib/kernel/qcoreapplication.cpp
+++ b/src/corelib/kernel/qcoreapplication.cpp
@@ -67,6 +67,7 @@
#ifdef Q_OS_SYMBIAN
# include <exception>
# include <f32file.h>
+# include <e32ldr.h>
# include "qeventdispatcher_symbian_p.h"
# include "private/qcore_symbian_p.h"
#elif defined(Q_OS_UNIX)
@@ -579,6 +580,27 @@ void QCoreApplication::init()
qt_core_eval_init(d->application_type);
#endif
+#if defined(Q_OS_SYMBIAN) \
+ && defined(Q_CC_NOKIAX86) \
+ && defined(QT_DEBUG)
+ /**
+ * Prevent the executable from being locked in the Symbian emulator. The
+ * code dramatically simplifies debugging on Symbian, but beyond that has
+ * no impact.
+ *
+ * Force the ZLazyUnloadTimer to fire and therefore unload code segments
+ * immediately. The code affects Symbian's file server and on the other
+ * hand needs only to be run once in each emulator run.
+ */
+ {
+ RLoader loader;
+ CleanupClosePushL(loader);
+ User::LeaveIfError(loader.Connect());
+ User::LeaveIfError(loader.CancelLazyDllUnload());
+ CleanupStack::PopAndDestroy(&loader);
+ }
+#endif
+
qt_startup_hook();
}
diff --git a/src/gui/dialogs/qfiledialog.ui b/src/gui/dialogs/qfiledialog.ui
index b52bd8a..1f35abb 100644
--- a/src/gui/dialogs/qfiledialog.ui
+++ b/src/gui/dialogs/qfiledialog.ui
@@ -83,6 +83,12 @@
<property name="toolTip" >
<string>Back</string>
</property>
+ <property name="accessibleName">
+ <string>Back</string>
+ </property>
+ <property name="accessibleDescription">
+ <string>Go back</string>
+ </property>
</widget>
</item>
<item>
@@ -90,6 +96,12 @@
<property name="toolTip" >
<string>Forward</string>
</property>
+ <property name="accessibleName">
+ <string>Forward</string>
+ </property>
+ <property name="accessibleDescription">
+ <string>Go forward</string>
+ </property>
</widget>
</item>
<item>
@@ -97,6 +109,12 @@
<property name="toolTip" >
<string>Parent Directory</string>
</property>
+ <property name="accessibleName">
+ <string>Parent Directory</string>
+ </property>
+ <property name="accessibleDescription">
+ <string>Go to the parent directory</string>
+ </property>
</widget>
</item>
<item>
@@ -104,6 +122,12 @@
<property name="toolTip" >
<string>Create New Folder</string>
</property>
+ <property name="accessibleName">
+ <string>Create New Folder</string>
+ </property>
+ <property name="accessibleDescription">
+ <string>Create a New Folder</string>
+ </property>
</widget>
</item>
<item>
@@ -111,6 +135,12 @@
<property name="toolTip" >
<string>List View</string>
</property>
+ <property name="accessibleName">
+ <string>List View</string>
+ </property>
+ <property name="accessibleDescription">
+ <string>Change to list view mode</string>
+ </property>
</widget>
</item>
<item>
@@ -118,6 +148,12 @@
<property name="toolTip" >
<string>Detail View</string>
</property>
+ <property name="accessibleName">
+ <string>Detail View</string>
+ </property>
+ <property name="accessibleDescription">
+ <string>Change to detail view mode</string>
+ </property>
</widget>
</item>
</layout>
diff --git a/src/gui/graphicsview/qgraphicsproxywidget.cpp b/src/gui/graphicsview/qgraphicsproxywidget.cpp
index 483eb62..2132526 100644
--- a/src/gui/graphicsview/qgraphicsproxywidget.cpp
+++ b/src/gui/graphicsview/qgraphicsproxywidget.cpp
@@ -1435,7 +1435,7 @@ void QGraphicsProxyWidget::paint(QPainter *painter, const QStyleOptionGraphicsIt
return;
// Filter out repaints on the window frame.
- const QRect exposedWidgetRect = (option->exposedRect & rect()).toRect();
+ const QRect exposedWidgetRect = (option->exposedRect & rect()).toAlignedRect();
if (exposedWidgetRect.isEmpty())
return;
diff --git a/src/gui/graphicsview/qgraphicswidget.cpp b/src/gui/graphicsview/qgraphicswidget.cpp
index 8e439be..bc8ccb01 100644
--- a/src/gui/graphicsview/qgraphicswidget.cpp
+++ b/src/gui/graphicsview/qgraphicswidget.cpp
@@ -1116,13 +1116,13 @@ QVariant QGraphicsWidget::itemChange(GraphicsItemChange change, const QVariant &
QApplication::sendEvent(this, &event);
break;
}
- case ItemCursorChange: {
+ case ItemCursorHasChanged: {
// Deliver CursorChange.
QEvent event(QEvent::CursorChange);
QApplication::sendEvent(this, &event);
break;
}
- case ItemToolTipChange: {
+ case ItemToolTipHasChanged: {
// Deliver ToolTipChange.
QEvent event(QEvent::ToolTipChange);
QApplication::sendEvent(this, &event);
diff --git a/src/gui/image/qimage.cpp b/src/gui/image/qimage.cpp
index ce1d6d3..d226baf 100644
--- a/src/gui/image/qimage.cpp
+++ b/src/gui/image/qimage.cpp
@@ -5709,6 +5709,9 @@ void QImage::setAlphaChannel(const QImage &alphaChannel)
else
*this = convertToFormat(QImage::Format_ARGB32_Premultiplied);
+ if (isNull())
+ return;
+
// Slight optimization since alphachannels are returned as 8-bit grays.
if (alphaChannel.d->depth == 8 && alphaChannel.isGrayscale()) {
const uchar *src_data = alphaChannel.d->data;
diff --git a/src/gui/image/qimagewriter.cpp b/src/gui/image/qimagewriter.cpp
index a5f7b31..503a1b2 100644
--- a/src/gui/image/qimagewriter.cpp
+++ b/src/gui/image/qimagewriter.cpp
@@ -197,6 +197,7 @@ static QImageIOHandler *createWriteHandlerHelper(QIODevice *device,
for (int i = 0; i < keys.size(); ++i) {
QImageIOPlugin *plugin = qobject_cast<QImageIOPlugin *>(l->instance(keys.at(i)));
if (plugin && (plugin->capabilities(device, testFormat) & QImageIOPlugin::CanWrite)) {
+ delete handler;
handler = plugin->create(device, testFormat);
break;
}
diff --git a/src/gui/itemviews/qtableview.cpp b/src/gui/itemviews/qtableview.cpp
index 43445b4..31be224 100644
--- a/src/gui/itemviews/qtableview.cpp
+++ b/src/gui/itemviews/qtableview.cpp
@@ -114,15 +114,14 @@ void QSpanCollection::updateSpan(QSpanCollection::Span *span, int old_height)
}
} else if (old_height > span->height()) {
//remove the span from all the subspans lists that intersect the columns not covered anymore
- Index::iterator it_y = index.lowerBound(-span->bottom());
- if (it_y == index.end())
- it_y = index.find(-span->top()); // This is the only span remaining and we are deleting it.
+ Index::iterator it_y = index.lowerBound(-qMax(span->bottom(), span->top())); //qMax usefull if height is 0
Q_ASSERT(it_y != index.end()); //it_y must exist since the span is in the list
while (-it_y.key() <= span->top() + old_height -1) {
if (-it_y.key() > span->bottom()) {
- (*it_y).remove(-span->left());
+ int removed = (*it_y).remove(-span->left());
+ Q_ASSERT(removed == 1); Q_UNUSED(removed);
if (it_y->isEmpty()) {
- it_y = index.erase(it_y) - 1;
+ it_y = index.erase(it_y);
}
}
if(it_y == index.begin())
diff --git a/src/gui/kernel/qapplication_s60.cpp b/src/gui/kernel/qapplication_s60.cpp
index 25a7bbe..c735d1f 100644
--- a/src/gui/kernel/qapplication_s60.cpp
+++ b/src/gui/kernel/qapplication_s60.cpp
@@ -372,8 +372,13 @@ QSymbianControl::~QSymbianControl()
{
if (S60->curWin == this)
S60->curWin = 0;
- if (!QApplicationPrivate::is_app_closing)
- setFocusSafely(false);
+ if (!QApplicationPrivate::is_app_closing) {
+ QT_TRY {
+ setFocusSafely(false);
+ } QT_CATCH(const std::exception&) {
+ // ignore exceptions, nothing can be done
+ }
+ }
S60->appUi()->RemoveFromStack(this);
delete m_longTapDetector;
}
@@ -989,7 +994,7 @@ void QSymbianControl::FocusChanged(TDrawNow /* aDrawNow */)
}
#endif
} else if (QApplication::activeWindow() == qwidget->window()) {
- if (CCoeEnv::Static()->AppUi()->IsDisplayingMenuOrDialog()) {
+ if (CCoeEnv::Static()->AppUi()->IsDisplayingMenuOrDialog() || S60->menuBeingConstructed) {
QWidget *fw = QApplication::focusWidget();
if (fw) {
QFocusEvent event(QEvent::FocusOut, Qt::PopupFocusReason);
@@ -1239,6 +1244,7 @@ void qt_init(QApplicationPrivate * /* priv */, int)
}
S60->avkonComponentsSupportTransparency = false;
+ S60->menuBeingConstructed = false;
#ifdef Q_WS_S60
TUid KCRUidAvkon = { 0x101F876E };
diff --git a/src/gui/kernel/qsoftkeymanager_s60.cpp b/src/gui/kernel/qsoftkeymanager_s60.cpp
index 7d643c2..c0761f0 100644
--- a/src/gui/kernel/qsoftkeymanager_s60.cpp
+++ b/src/gui/kernel/qsoftkeymanager_s60.cpp
@@ -365,17 +365,30 @@ void QSoftKeyManagerPrivateS60::updateSoftKeys_sys()
nativeContainer->DrawDeferred(); // 3.1 needs an extra invitation
}
+static void resetMenuBeingConstructed(TAny* /*aAny*/)
+{
+ S60->menuBeingConstructed = false;
+}
+
+void QSoftKeyManagerPrivateS60::tryDisplayMenuBarL()
+{
+ CleanupStack::PushL(TCleanupItem(resetMenuBeingConstructed, NULL));
+ S60->menuBeingConstructed = true;
+ S60->menuBar()->TryDisplayMenuBarL();
+ CleanupStack::PopAndDestroy(); // Reset menuBeingConstructed to false in all cases
+}
+
bool QSoftKeyManagerPrivateS60::handleCommand(int command)
{
QAction *action = realSoftKeyActions.value(command);
if (action) {
QVariant property = action->property(MENU_ACTION_PROPERTY);
if (property.isValid() && property.toBool()) {
- QT_TRAP_THROWING(S60->menuBar()->TryDisplayMenuBarL());
+ QT_TRAP_THROWING(tryDisplayMenuBarL());
} else if (action->menu()) {
// TODO: This is hack, in order to use exising QMenuBar implementation for Symbian
// menubar needs to have widget to which it is associated. Since we want to associate
- // menubar to action (which is inherited from QObejct), we create and associate QWidget
+ // menubar to action (which is inherited from QObject), we create and associate QWidget
// to action and pass that for QMenuBar. This associates the menubar to action, and we
// can have own menubar for each action.
QWidget *actionContainer = action->property("_q_action_widget").value<QWidget*>();
@@ -394,15 +407,15 @@ bool QSoftKeyManagerPrivateS60::handleCommand(int command)
action->setProperty("_q_action_widget", v);
}
qt_symbian_next_menu_from_action(actionContainer);
- QT_TRAP_THROWING(S60->menuBar()->TryDisplayMenuBarL());
- } else {
- Q_ASSERT(action->softKeyRole() != QAction::NoSoftKey);
- QWidget *actionParent = action->parentWidget();
- Q_ASSERT_X(actionParent, Q_FUNC_INFO, "No parent set for softkey action!");
- if (actionParent->isEnabled()) {
- action->activate(QAction::Trigger);
- return true;
- }
+ QT_TRAP_THROWING(tryDisplayMenuBarL());
+ }
+
+ Q_ASSERT(action->softKeyRole() != QAction::NoSoftKey);
+ QWidget *actionParent = action->parentWidget();
+ Q_ASSERT_X(actionParent, Q_FUNC_INFO, "No parent set for softkey action!");
+ if (actionParent->isEnabled()) {
+ action->activate(QAction::Trigger);
+ return true;
}
}
return false;
diff --git a/src/gui/kernel/qsoftkeymanager_s60_p.h b/src/gui/kernel/qsoftkeymanager_s60_p.h
index a5e5016..d14993c 100644
--- a/src/gui/kernel/qsoftkeymanager_s60_p.h
+++ b/src/gui/kernel/qsoftkeymanager_s60_p.h
@@ -78,6 +78,7 @@ public:
bool handleCommand(int command);
private:
+ void tryDisplayMenuBarL();
bool skipCbaUpdate();
void ensureCbaVisibilityAndResponsiviness(CEikButtonGroupContainer &cba);
void clearSoftkeys(CEikButtonGroupContainer &cba);
diff --git a/src/gui/kernel/qt_s60_p.h b/src/gui/kernel/qt_s60_p.h
index 7c6b754..a714221 100644
--- a/src/gui/kernel/qt_s60_p.h
+++ b/src/gui/kernel/qt_s60_p.h
@@ -122,6 +122,7 @@ public:
int qtOwnsS60Environment : 1;
int supportsPremultipliedAlpha : 1;
int avkonComponentsSupportTransparency : 1;
+ int menuBeingConstructed : 1;
QApplication::QS60MainApplicationFactory s60ApplicationFactory; // typedef'ed pointer type
static inline void updateScreenSize();
static inline RWsSession& wsSession();
diff --git a/src/gui/kernel/qwidget.cpp b/src/gui/kernel/qwidget.cpp
index e88026c..72ffe87 100644
--- a/src/gui/kernel/qwidget.cpp
+++ b/src/gui/kernel/qwidget.cpp
@@ -1506,8 +1506,12 @@ QWidget::~QWidget()
if (QWidgetPrivate::allWidgets) // might have been deleted by ~QApplication
QWidgetPrivate::allWidgets->remove(this);
- QEvent e(QEvent::Destroy);
- QCoreApplication::sendEvent(this, &e);
+ QT_TRY {
+ QEvent e(QEvent::Destroy);
+ QCoreApplication::sendEvent(this, &e);
+ } QT_CATCH(const std::exception&) {
+ // if this fails we can't do anything about it but at least we are not allowed to throw.
+ }
}
int QWidgetPrivate::instanceCounter = 0; // Current number of widget instances
diff --git a/src/gui/text/qtextcontrol.cpp b/src/gui/text/qtextcontrol.cpp
index 671dfc0..3c596e5 100644
--- a/src/gui/text/qtextcontrol.cpp
+++ b/src/gui/text/qtextcontrol.cpp
@@ -1201,7 +1201,8 @@ void QTextControlPrivate::keyPressEvent(QKeyEvent *e)
blockFmt.setIndent(blockFmt.indent() - 1);
cursor.setBlockFormat(blockFmt);
} else {
- cursor.deletePreviousChar();
+ QTextCursor localCursor = cursor;
+ localCursor.deletePreviousChar();
}
goto accept;
}
@@ -1239,7 +1240,8 @@ void QTextControlPrivate::keyPressEvent(QKeyEvent *e)
}
#endif
else if (e == QKeySequence::Delete) {
- cursor.deleteChar();
+ QTextCursor localCursor = cursor;
+ localCursor.deleteChar();
}
else if (e == QKeySequence::DeleteEndOfWord) {
if (!cursor.hasSelection())
diff --git a/src/gui/widgets/qmenu.cpp b/src/gui/widgets/qmenu.cpp
index 404d46e..9e190b7 100644
--- a/src/gui/widgets/qmenu.cpp
+++ b/src/gui/widgets/qmenu.cpp
@@ -1398,12 +1398,14 @@ QMenu::QMenu(QMenuPrivate &dd, QWidget *parent)
QMenu::~QMenu()
{
Q_D(QMenu);
- QHash<QAction *, QWidget *>::iterator it = d->widgetItems.begin();
- for (; it != d->widgetItems.end(); ++it) {
- if (QWidget *widget = it.value()) {
- QWidgetAction *action = static_cast<QWidgetAction *>(it.key());
- action->releaseWidget(widget);
- *it = 0;
+ if (!d->widgetItems.isEmpty()) { // avoid detach on shared null hash
+ QHash<QAction *, QWidget *>::iterator it = d->widgetItems.begin();
+ for (; it != d->widgetItems.end(); ++it) {
+ if (QWidget *widget = it.value()) {
+ QWidgetAction *action = static_cast<QWidgetAction *>(it.key());
+ action->releaseWidget(widget);
+ *it = 0;
+ }
}
}
diff --git a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp
index 9ed722f..0a452f3 100644
--- a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp
+++ b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp
@@ -191,7 +191,7 @@ void QGL2PaintEngineExPrivate::updateBrushTexture()
QImage texImage = qt_imageForBrush(style, false);
glActiveTexture(GL_TEXTURE0 + QT_BRUSH_TEXTURE_UNIT);
- ctx->d_func()->bindTexture(texImage, GL_TEXTURE_2D, GL_RGBA, true, QGLContext::InternalBindOption);
+ ctx->d_func()->bindTexture(texImage, GL_TEXTURE_2D, GL_RGBA, QGLContext::InternalBindOption);
updateTextureFilter(GL_TEXTURE_2D, GL_REPEAT, q->state()->renderHints & QPainter::SmoothPixmapTransform);
}
else if (style >= Qt::LinearGradientPattern && style <= Qt::ConicalGradientPattern) {
diff --git a/src/opengl/gl2paintengineex/qtriangulatingstroker.cpp b/src/opengl/gl2paintengineex/qtriangulatingstroker.cpp
index d952988..7eae78f 100644
--- a/src/opengl/gl2paintengineex/qtriangulatingstroker.cpp
+++ b/src/opengl/gl2paintengineex/qtriangulatingstroker.cpp
@@ -144,11 +144,17 @@ void QTriangulatingStroker::process(const QVectorPath &path, const QPen &pen, co
m_cos_theta = qFastCos(Q_PI / m_roundness);
const qreal *endPts = pts + (count<<1);
- const qreal *startPts;
+ const qreal *startPts = 0;
Qt::PenCapStyle cap = m_cap_style;
if (!types) {
+ // skip duplicate points
+ while((pts + 2) < endPts && pts[0] == pts[2] && pts[1] == pts[3])
+ pts += 2;
+ if ((pts + 2) == endPts)
+ return;
+
startPts = pts;
bool endsAtStart = startPts[0] == *(endPts-2) && startPts[1] == *(endPts-1);
@@ -161,15 +167,17 @@ void QTriangulatingStroker::process(const QVectorPath &path, const QPen &pen, co
lineTo(pts);
pts += 2;
while (pts < endPts) {
- join(pts);
- lineTo(pts);
+ if (m_cx != pts[0] || m_cy != pts[1]) {
+ join(pts);
+ lineTo(pts);
+ }
pts += 2;
}
endCapOrJoinClosed(startPts, pts-2, path.hasImplicitClose(), endsAtStart);
} else {
- bool endsAtStart;
+ bool endsAtStart = false;
while (pts < endPts) {
switch (*types) {
case QPainterPath::MoveToElement: {
diff --git a/src/openvg/qwindowsurface_vgegl.cpp b/src/openvg/qwindowsurface_vgegl.cpp
index 9b55fd2..13ae807 100644
--- a/src/openvg/qwindowsurface_vgegl.cpp
+++ b/src/openvg/qwindowsurface_vgegl.cpp
@@ -659,6 +659,7 @@ QEglContext *QVGEGLWindowSurfaceDirect::ensureContext(QWidget *widget)
#endif
windowSurface = context->createSurface(widget, &surfaceProps);
isPaintingActive = false;
+ needToSwap = true;
}
#else
if (context && size != newSize) {
@@ -710,20 +711,21 @@ QEglContext *QVGEGLWindowSurfaceDirect::ensureContext(QWidget *widget)
needToSwap = false;
}
#endif
-#if !defined(QVG_NO_PRESERVED_SWAP)
- // Try to force the surface back buffer to preserve its contents.
- if (needToSwap) {
- eglGetError(); // Clear error state first.
- eglSurfaceAttrib(QEgl::display(), surface,
- EGL_SWAP_BEHAVIOR, EGL_BUFFER_PRESERVED);
- if (eglGetError() != EGL_SUCCESS) {
- qWarning("QVG: could not enable preserved swap");
- }
- }
-#endif
windowSurface = surface;
isPaintingActive = false;
}
+
+#if !defined(QVG_NO_PRESERVED_SWAP)
+ // Try to force the surface back buffer to preserve its contents.
+ if (needToSwap) {
+ eglGetError(); // Clear error state first.
+ eglSurfaceAttrib(QEgl::display(), windowSurface,
+ EGL_SWAP_BEHAVIOR, EGL_BUFFER_PRESERVED);
+ if (eglGetError() != EGL_SUCCESS) {
+ qWarning("QVG: could not enable preserved swap");
+ }
+ }
+#endif
return context;
}
diff --git a/src/plugins/accessible/widgets/complexwidgets.cpp b/src/plugins/accessible/widgets/complexwidgets.cpp
index b4ca8f2..8be1560 100644
--- a/src/plugins/accessible/widgets/complexwidgets.cpp
+++ b/src/plugins/accessible/widgets/complexwidgets.cpp
@@ -724,7 +724,8 @@ public:
if (start.isValid()) {
m_current = start;
} else if (m_view && m_view->model()) {
- m_current = view->model()->index(0, 0);
+ m_current = view->rootIndex().isValid() ?
+ view->rootIndex().child(0,0) : view->model()->index(0, 0);
}
}