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:
Jonas Kulla 2013-12-15 10:13:58 +01:00
parent 5f290c5b11
commit 91c5eb1861
2 changed files with 13 additions and 13 deletions

View file

@ -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()));