Changeset View
Changeset View
Standalone View
Standalone View
src/kdeclarative/qmlobjectsharedengine.cpp
Show All 12 Lines | |||||
13 | * | 13 | * | ||
14 | * You should have received a copy of the GNU Library General Public | 14 | * You should have received a copy of the GNU Library General Public | ||
15 | * License along with this program; if not, write to the | 15 | * License along with this program; if not, write to the | ||
16 | * Free Software Foundation, Inc., | 16 | * Free Software Foundation, Inc., | ||
17 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | 17 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | ||
18 | */ | 18 | */ | ||
19 | 19 | | |||
20 | #include "qmlobjectsharedengine.h" | 20 | #include "qmlobjectsharedengine.h" | ||
21 | #include "private/qmlobject_p.h" | | |||
22 | 21 | | |||
23 | #include <QQmlComponent> | 22 | #include <QQmlComponent> | ||
24 | #include <QQmlEngine> | 23 | #include <QQmlEngine> | ||
25 | #include <QQmlContext> | 24 | #include <QQmlContext> | ||
26 | #include <QPointer> | 25 | #include <QPointer> | ||
27 | 26 | | |||
28 | #include <qdebug.h> | 27 | #include <qdebug.h> | ||
29 | #include <kdeclarative.h> | 28 | #include <kdeclarative.h> | ||
Show All 19 Lines | 47 | if (engineRef.use_count() == 2) { | |||
49 | s_engine.reset(); | 48 | s_engine.reset(); | ||
50 | } | 49 | } | ||
51 | } | 50 | } | ||
52 | 51 | | |||
53 | static QQmlEngine *engine() | 52 | static QQmlEngine *engine() | ||
54 | { | 53 | { | ||
55 | if (!s_engine) { | 54 | if (!s_engine) { | ||
56 | s_engine = std::make_shared<QQmlEngine>(); | 55 | s_engine = std::make_shared<QQmlEngine>(); | ||
57 | s_engine->setIncubationController(new QmlObjectIncubationController(0)); | | |||
58 | } | 56 | } | ||
59 | return s_engine.get(); | 57 | return s_engine.get(); | ||
60 | } | 58 | } | ||
61 | 59 | | |||
62 | //used to delete it | 60 | //used to delete it | ||
63 | std::shared_ptr<QQmlEngine> engineRef; | 61 | std::shared_ptr<QQmlEngine> engineRef; | ||
64 | 62 | | |||
65 | static std::shared_ptr<QQmlEngine> s_engine; | 63 | static std::shared_ptr<QQmlEngine> s_engine; | ||
Show All 19 Lines |