Wiki page eo-classes.md changed with summary [added missing efl_unref()] by Xavi Artigas

This commit is contained in:
Xavi Artigas 2017-11-17 04:27:23 -08:00 committed by apache
parent 120e8981e6
commit 4db4870faf
1 changed files with 6 additions and 0 deletions

View File

@ -262,8 +262,12 @@ And call it from ``efl_main()``, right before calling ``efl_exit()``:
Eo *rectangle;
rectangle = _rect_create();
efl_unref(rectangle);
```
Notice how the object is disposed of using ``efl_unref()`` before quitting. It is a good idea to write the code to remove objects at the same time you write the code that creates them, so you don't forget. Later on you will be doing more things with this ``rectangle``.
Finally, instantiate a new object of your shiny new class from within ``_rect_create()``:
```c
@ -326,6 +330,8 @@ efl_main(void *data EINA_UNUSED, const Efl_Event *ev EINA_UNUSED)
example_rectangle_width_get(rectangle),
example_rectangle_height_get(rectangle),
example_rectangle_area(rectangle));
efl_unref(rectangle);
efl_exit(0);
}