MRI-Binding: Fix typo that led to access of freed Color objects
Also fix my moronic variable naming in the InitCopy functions that let to this mess up in the first place.
This commit is contained in:
parent
5f290c5b11
commit
91c5eb1861
|
@ -199,14 +199,14 @@ rb_bool_new(bool value)
|
|||
#define INITCOPY_FUN(Klass) \
|
||||
RB_METHOD(Klass##InitializeCopy) \
|
||||
{ \
|
||||
VALUE orig; \
|
||||
rb_get_args(argc, argv, "o", &orig, RB_ARG_END); \
|
||||
if (!OBJ_INIT_COPY(self, orig)) /* When would this fail??*/\
|
||||
VALUE origObj; \
|
||||
rb_get_args(argc, argv, "o", &origObj, RB_ARG_END); \
|
||||
if (!OBJ_INIT_COPY(self, origObj)) /* When would this fail??*/\
|
||||
return self; \
|
||||
Klass *k = getPrivateData<Klass>(orig); \
|
||||
Klass *dup = 0; \
|
||||
GUARD_EXC( dup = new Klass(*k); ) \
|
||||
setPrivateData(self, dup); \
|
||||
Klass *orig = getPrivateData<Klass>(origObj); \
|
||||
Klass *k = 0; \
|
||||
GUARD_EXC( k = new Klass(*orig); ) \
|
||||
setPrivateData(self, k); \
|
||||
return self; \
|
||||
}
|
||||
|
||||
|
|
|
@ -56,15 +56,15 @@ RB_METHOD(fontInitialize)
|
|||
|
||||
RB_METHOD(fontInitializeCopy)
|
||||
{
|
||||
VALUE orig;
|
||||
rb_get_args(argc, argv, "o", &orig, RB_ARG_END);
|
||||
VALUE origObj;
|
||||
rb_get_args(argc, argv, "o", &origObj, RB_ARG_END);
|
||||
|
||||
if (!OBJ_INIT_COPY(self, orig))
|
||||
if (!OBJ_INIT_COPY(self, origObj))
|
||||
return self;
|
||||
|
||||
Font *f = getPrivateData<Font>(orig);
|
||||
Font *dup = new Font(*f);
|
||||
setPrivateData(self, dup);
|
||||
Font *orig = getPrivateData<Font>(origObj);
|
||||
Font *f = new Font(*orig);
|
||||
setPrivateData(self, f);
|
||||
|
||||
/* Wrap property objects */
|
||||
f->setColor(new Color(*f->getColor()));
|
||||
|
|
Loading…
Reference in New Issue