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) \
|
#define INITCOPY_FUN(Klass) \
|
||||||
RB_METHOD(Klass##InitializeCopy) \
|
RB_METHOD(Klass##InitializeCopy) \
|
||||||
{ \
|
{ \
|
||||||
VALUE orig; \
|
VALUE origObj; \
|
||||||
rb_get_args(argc, argv, "o", &orig, RB_ARG_END); \
|
rb_get_args(argc, argv, "o", &origObj, RB_ARG_END); \
|
||||||
if (!OBJ_INIT_COPY(self, orig)) /* When would this fail??*/\
|
if (!OBJ_INIT_COPY(self, origObj)) /* When would this fail??*/\
|
||||||
return self; \
|
return self; \
|
||||||
Klass *k = getPrivateData<Klass>(orig); \
|
Klass *orig = getPrivateData<Klass>(origObj); \
|
||||||
Klass *dup = 0; \
|
Klass *k = 0; \
|
||||||
GUARD_EXC( dup = new Klass(*k); ) \
|
GUARD_EXC( k = new Klass(*orig); ) \
|
||||||
setPrivateData(self, dup); \
|
setPrivateData(self, k); \
|
||||||
return self; \
|
return self; \
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -56,15 +56,15 @@ RB_METHOD(fontInitialize)
|
||||||
|
|
||||||
RB_METHOD(fontInitializeCopy)
|
RB_METHOD(fontInitializeCopy)
|
||||||
{
|
{
|
||||||
VALUE orig;
|
VALUE origObj;
|
||||||
rb_get_args(argc, argv, "o", &orig, RB_ARG_END);
|
rb_get_args(argc, argv, "o", &origObj, RB_ARG_END);
|
||||||
|
|
||||||
if (!OBJ_INIT_COPY(self, orig))
|
if (!OBJ_INIT_COPY(self, origObj))
|
||||||
return self;
|
return self;
|
||||||
|
|
||||||
Font *f = getPrivateData<Font>(orig);
|
Font *orig = getPrivateData<Font>(origObj);
|
||||||
Font *dup = new Font(*f);
|
Font *f = new Font(*orig);
|
||||||
setPrivateData(self, dup);
|
setPrivateData(self, f);
|
||||||
|
|
||||||
/* Wrap property objects */
|
/* Wrap property objects */
|
||||||
f->setColor(new Color(*f->getColor()));
|
f->setColor(new Color(*f->getColor()));
|
||||||
|
|
Loading…
Reference in New Issue