summaryrefslogtreecommitdiff
path: root/clients/eventdemo.c
diff options
context:
space:
mode:
authorMartin Olsson <martin@minimum.se>2012-07-08 11:11:18 +0200
committerKristian Høgsberg <krh@bitplanet.net>2012-07-09 17:50:57 -0400
commitc663b22c2068fb73e6278b6f89f1b2abb500d03f (patch)
treeda62a7e08b3575ef5a492f95b6a96c2741c8840f /clients/eventdemo.c
parent8df662ad87e969def07d161aebfd6da59929014d (diff)
downloadweston-c663b22c2068fb73e6278b6f89f1b2abb500d03f.tar.gz
clients: Free resources on exit in eventdemo
Diffstat (limited to 'clients/eventdemo.c')
-rw-r--r--clients/eventdemo.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/clients/eventdemo.c b/clients/eventdemo.c
index daf32839..22dade32 100644
--- a/clients/eventdemo.c
+++ b/clients/eventdemo.c
@@ -261,6 +261,7 @@ motion_handler(struct widget *widget, struct input *input, uint32_t time,
/**
* \brief Create and initialise a new eventdemo window.
+ * The returned eventdemo instance should be destroyed using \c eventdemo_destroy().
* \param d associated display
*/
static struct eventdemo *
@@ -320,6 +321,16 @@ eventdemo_create(struct display *d)
return e;
}
/**
+ * \brief Destroy eventdemo instance previously created by \c eventdemo_create().
+ * \param eventdemo eventdemo instance to destroy
+ */
+static void eventdemo_destroy(struct eventdemo * eventdemo)
+{
+ widget_destroy(eventdemo->widget);
+ window_destroy(eventdemo->window);
+ free(eventdemo);
+}
+/**
* \brief command line options for eventdemo
*/
static const struct weston_option eventdemo_options[] = {
@@ -366,5 +377,9 @@ main(int argc, char *argv[])
display_run(d);
+ /* Release resources */
+ eventdemo_destroy(e);
+ display_destroy(d);
+
return 0;
}