projects
/
ruby-ecore.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Fixed the build with the latest Ecore snapshot.
[ruby-ecore.git]
/
src
/
ecore
/
rb_animator.c
diff --git
a/src/ecore/rb_animator.c
b/src/ecore/rb_animator.c
index 6544baa9968e396c9c1f7ea59dedcf0e1e505097..a5eb846d44f1914aea71782efa6d61cdf26e4273 100644
(file)
--- a/
src/ecore/rb_animator.c
+++ b/
src/ecore/rb_animator.c
@@
-1,6
+1,4
@@
/*
/*
- * $Id: rb_animator.c 146 2004-11-27 15:38:52Z tilman $
- *
* Copyright (C) 2004 ruby-ecore team (see AUTHORS)
*
* This library is free software; you can redistribute it and/or
* Copyright (C) 2004 ruby-ecore team (see AUTHORS)
*
* This library is free software; you can redistribute it and/or
@@
-25,6
+23,8
@@
#include "rb_ecore.h"
#include "rb_ecore.h"
+void Init_stack (VALUE *addr);
+
typedef struct {
Ecore_Animator *real;
VALUE callback;
typedef struct {
Ecore_Animator *real;
VALUE callback;
@@
-35,6
+35,15
@@
static int on_animator (void *data)
{
VALUE r;
RbAnimator *animator = data;
{
VALUE r;
RbAnimator *animator = data;
+ static bool initted;
+
+ /* this fixes a weird segfault that occured when the animator's
+ * callback was called from a Ecore::Timer callback.
+ */
+ if (!initted) {
+ Init_stack (0);
+ initted = true;
+ }
r = rb_funcall (animator->callback, rb_intern ("call"), 0);
r = rb_funcall (animator->callback, rb_intern ("call"), 0);
@@
-62,24
+71,26
@@
static void c_free (RbAnimator *animator)
free (animator);
}
free (animator);
}
-static VALUE c_
new
(VALUE klass)
+static VALUE c_
alloc
(VALUE klass)
{
{
- VALUE self;
RbAnimator *animator = NULL;
RbAnimator *animator = NULL;
- if (!rb_block_given_p ())
- return Qnil;
+ ecore_init ();
- self = Data_Make_Struct (klass, RbAnimator, c_mark, c_free, animator);
+ return Data_Make_Struct (klass, RbAnimator, c_mark, c_free, animator);
+}
- ecore_init ();
+static VALUE c_init (VALUE self)
+{
+ GET_OBJ (self, RbAnimator, animator);
+
+ if (!rb_block_given_p ())
+ rb_raise (rb_eStandardError, "block missing");
animator->callback = rb_block_proc ();
animator->deleted = false;
animator->real = ecore_animator_add (on_animator, animator);
animator->callback = rb_block_proc ();
animator->deleted = false;
animator->real = ecore_animator_add (on_animator, animator);
- rb_obj_call_init (self, 0, NULL);
-
return self;
}
return self;
}
@@
-101,6
+112,7
@@
void Init_Animator (void)
{
VALUE c = rb_define_class_under (mEcore, "Animator", rb_cObject);
{
VALUE c = rb_define_class_under (mEcore, "Animator", rb_cObject);
- rb_define_singleton_method (c, "new", c_new, 0);
+ rb_define_alloc_func (c, c_alloc);
+ rb_define_method (c, "initialize", c_init, 0);
rb_define_method (c, "delete", c_delete, 0);
}
rb_define_method (c, "delete", c_delete, 0);
}