re-add std::vector<std::string> just for cairo's set_dash()
authorRobin Gareus <robin@gareus.org>
Mon, 4 Apr 2016 21:59:42 +0000 (23:59 +0200)
committerRobin Gareus <robin@gareus.org>
Mon, 4 Apr 2016 22:00:06 +0000 (00:00 +0200)
This fixes crash with the window version.

gtk2_ardour/luainstance.cc

index 6f293986bf52d045828ce1bd46b34d92fd1f7b85..8197284e69801d425fe6219026a242cb402a30e7 100644 (file)
@@ -102,6 +102,20 @@ LuaInstance::register_hooks (lua_State* L)
 void
 LuaInstance::bind_cairo (lua_State* L)
 {
+       /* std::vector<double> for set_dash()
+        * for Windows (DLL, .exe) this needs to be bound in the same memory context as "Cairo".
+        *
+        * The std::vector<> argument in set_dash() has a fixed address in ardour.exe, while
+        * the address of the one in libardour.dll is mapped when loading the .dll
+        *
+        * see LuaBindings::set_session() for a detailed explanation
+        */
+       luabridge::getGlobalNamespace (L)
+               .beginNamespace ("C")
+               .beginStdVector <double> ("DoubleVector")
+               .endClass ()
+               .endNamespace ();
+
        luabridge::getGlobalNamespace (L)
                .beginNamespace ("Cairo")
                .beginClass <Cairo::Context> ("Context")
@@ -114,7 +128,7 @@ LuaInstance::bind_cairo (lua_State* L)
                .addFunction ("set_line_width", &Cairo::Context::set_line_width)
                .addFunction ("set_line_cap", &Cairo::Context::set_line_cap)
                .addFunction ("set_line_join", &Cairo::Context::set_line_join)
-               .addFunction ("set_dash", (void (Cairo::Context::*)(std::vector<double>&, double))&Cairo::Context::set_dash)
+               .addFunction ("set_dash", (void (Cairo::Context::*)(const std::vector<double>&, double))&Cairo::Context::set_dash)
                .addFunction ("unset_dash", &Cairo::Context::unset_dash)
                .addFunction ("translate", &Cairo::Context::translate)
                .addFunction ("scale", &Cairo::Context::scale)