inkscape/inkscape-swigfix.patch

27 lines
956 B
Diff
Raw Normal View History

--- src/extension/script/inkscape_perl_wrap.cpp
+++ src/extension/script/inkscape_perl_wrap.cpp
@@ -776,14 +776,17 @@
static void _swig_create_magic(CPerlObj *pPerl, SV *sv, const char *name, int (CPerlObj::*set)(SV *, MAGIC *), int (CPerlObj::*get)(SV *, MAGIC *)) {
#endif
MAGIC *mg;
+ MGVTBL *mgvtbl;
sv_magic(sv,sv,'U',(char *) name,strlen(name));
mg = mg_find(sv,'U');
- mg->mg_virtual = (MGVTBL *) malloc(sizeof(MGVTBL));
- mg->mg_virtual->svt_get = (SwigMagicFuncHack) get;
- mg->mg_virtual->svt_set = (SwigMagicFuncHack) set;
- mg->mg_virtual->svt_len = 0;
- mg->mg_virtual->svt_clear = 0;
- mg->mg_virtual->svt_free = 0;
+ mgvtbl = (MGVTBL *) malloc(sizeof(MGVTBL));
+ memcpy((void*)mgvtbl, (const void*)mg, sizeof(MGVTBL));
+ mgvtbl->svt_get = (SwigMagicFuncHack) get;
+ mgvtbl->svt_set = (SwigMagicFuncHack) set;
+ mgvtbl->svt_len = 0;
+ mgvtbl->svt_clear = 0;
+ mgvtbl->svt_free = 0;
+ mg->mg_virtual = mgvtbl;
}