aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/jsruntime/qv4regexpobject_p.h
diff options
context:
space:
mode:
authorAllan Sandfeld Jensen <allan.jensen@qt.io>2017-08-08 12:39:54 +0200
committerAllan Sandfeld Jensen <allan.jensen@qt.io>2017-09-08 17:45:06 +0000
commitc1fed764a2495373a9e4563bc3ac0d578b2f9409 (patch)
treee263aa10cd111d4d8f0d4e1cfeb49460f2a0eb2b /src/qml/jsruntime/qv4regexpobject_p.h
parent5f17840a14e22da0cfa973b36b9f6ce3bc8d4067 (diff)
Fix reuse of regexp objects by regexp literals
Accoding to the standard the regexp objects created by literals should be separate objects as if calling new. We were violating that by caching the same object for every instance of a literal. This also fixes a problem with leaking values of lastIndex between separate instances of the same global regexp literal. Task-number: QTBUG-62175 Change-Id: Ib22e9ee68de1d1209fbd4212e72f576bc059d245 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Diffstat (limited to 'src/qml/jsruntime/qv4regexpobject_p.h')
-rw-r--r--src/qml/jsruntime/qv4regexpobject_p.h6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/qml/jsruntime/qv4regexpobject_p.h b/src/qml/jsruntime/qv4regexpobject_p.h
index 54731cef14..af49a1bf5e 100644
--- a/src/qml/jsruntime/qv4regexpobject_p.h
+++ b/src/qml/jsruntime/qv4regexpobject_p.h
@@ -60,6 +60,7 @@
#include "qv4managed_p.h"
#include "qv4property_p.h"
#include "qv4objectiterator_p.h"
+#include "qv4regexp_p.h"
#include <QtCore/QString>
#include <QtCore/QHash>
@@ -75,11 +76,10 @@ namespace Heap {
struct RegExpObject : Object {
void init();
- void init(QV4::RegExp *value, bool global);
+ void init(QV4::RegExp *value);
void init(const QRegExp &re);
Pointer<RegExp> value;
- bool global;
};
struct RegExpCtor : FunctionObject {
@@ -117,7 +117,7 @@ struct RegExpObject: Object {
};
Heap::RegExp *value() const { return d()->value; }
- bool global() const { return d()->global; }
+ bool global() const { return d()->value->global; }
void initProperties();