clients: Free resources on exit in eventdemo
This commit is contained in:
committed by
Kristian Høgsberg
parent
8df662ad87
commit
c663b22c20
@@ -261,6 +261,7 @@ motion_handler(struct widget *widget, struct input *input, uint32_t time,
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Create and initialise a new eventdemo window.
|
* \brief Create and initialise a new eventdemo window.
|
||||||
|
* The returned eventdemo instance should be destroyed using \c eventdemo_destroy().
|
||||||
* \param d associated display
|
* \param d associated display
|
||||||
*/
|
*/
|
||||||
static struct eventdemo *
|
static struct eventdemo *
|
||||||
@@ -319,6 +320,16 @@ eventdemo_create(struct display *d)
|
|||||||
|
|
||||||
return e;
|
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
|
* \brief command line options for eventdemo
|
||||||
*/
|
*/
|
||||||
@@ -366,5 +377,9 @@ main(int argc, char *argv[])
|
|||||||
|
|
||||||
display_run(d);
|
display_run(d);
|
||||||
|
|
||||||
|
/* Release resources */
|
||||||
|
eventdemo_destroy(e);
|
||||||
|
display_destroy(d);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user