History

avoid Qt QTimer thread bug by putting SoundCache on same thread

Stephen Birarda committed 11 years ago

Commit e10d1321 parent a771f7211 files · +74 −61Browse files

Showing the changes to libraries/script-engine/src/ScriptEngine.cpp (1 of 11 files). Show all

Unified · Split

libraries/script-engine/src/ScriptEngine.cpp+0−13
@@ -27,7 +27,6 @@ · 26 unmodified lines
2727 #include <NetworkAccessManager.h>
2828 #include <NodeList.h>
2929 #include <PacketHeaders.h>
30−#include <Sound.h>
3130 #include <UUID.h>
3231 #include <VoxelConstants.h>
3332 #include <VoxelDetail.h>
@@ -47,14 +46,6 @@ · 13 unmodified lines
4746 VoxelsScriptingInterface ScriptEngine::_voxelsScriptingInterface;
4847 EntityScriptingInterface ScriptEngine::_entityScriptingInterface;
4948
50−static QScriptValue soundConstructor(QScriptContext* context, QScriptEngine* engine) {
51− QUrl soundURL = QUrl(context->argument(0).toString());
52− bool isStereo = context->argument(1).toBool();
53− QScriptValue soundScriptValue = engine->newQObject(new Sound(soundURL, isStereo), QScriptEngine::ScriptOwnership);
54−
55− return soundScriptValue;
56−}
57−
5849 static QScriptValue debugPrint(QScriptContext* context, QScriptEngine* engine){
5950 qDebug() << "script:print()<<" << context->argument(0).toString();
6051 QString message = context->argument(0).toString()
@@ -263,10 +254,6 @@ void ScriptEngine::init() { · 202 unmodified lines
263254 QScriptValue printConstructorValue = newFunction(debugPrint);
264255 globalObject().setProperty("print", printConstructorValue);
265256
266− QScriptValue soundConstructorValue = newFunction(soundConstructor);
267− QScriptValue soundMetaObject = newQMetaObject(&Sound::staticMetaObject, soundConstructorValue);
268− globalObject().setProperty("Sound", soundMetaObject);
269−
270257 QScriptValue localVoxelsValue = scriptValueFromQMetaObject<LocalVoxels>();
271258 globalObject().setProperty("LocalVoxels", localVoxelsValue);
272259