Remove event handlers on destroy in plugins

This is because we can end up in scenarios
where a plugin gets destroyed, and readded
without getting hidden in between.
This commit is contained in:
Ray Strode 2009-03-09 12:18:56 -04:00
parent 2b0d185546
commit 546fbdc0b8
7 changed files with 23 additions and 0 deletions

View file

@ -64,6 +64,14 @@ typedef enum {
typedef void (* ply_boot_splash_plugin_window_handler_t) (ply_window_t *window, ply_boot_splash_plugin_t *, void *user_data, void *other_user_data);
static void uninitialize_window (ply_window_t *window,
ply_boot_splash_plugin_t *plugin);
static void for_each_window (ply_boot_splash_plugin_t *plugin,
ply_boot_splash_plugin_window_handler_t handler,
void *user_data,
void *other_user_data);
ply_boot_splash_plugin_interface_t *ply_boot_splash_plugin_get_interface (void);
struct _ply_boot_splash_plugin
{
@ -94,6 +102,10 @@ destroy_plugin (ply_boot_splash_plugin_t *plugin)
if (plugin == NULL)
return;
for_each_window (plugin,
(ply_boot_splash_plugin_window_handler_t)
uninitialize_window, NULL, NULL);
ply_list_free (plugin->windows);
free (plugin);

View file

@ -167,6 +167,8 @@ destroy_plugin (ply_boot_splash_plugin_t *plugin)
if (plugin == NULL)
return;
remove_handlers (plugin);
if (plugin->loop != NULL)
{
ply_event_loop_stop_watching_for_exit (plugin->loop, (ply_event_loop_exit_handler_t)

View file

@ -125,6 +125,8 @@ destroy_plugin (ply_boot_splash_plugin_t *plugin)
if (plugin == NULL)
return;
remove_handlers (plugin);
if (plugin->loop != NULL)
{
ply_event_loop_stop_watching_for_exit (plugin->loop, (ply_event_loop_exit_handler_t)

View file

@ -102,6 +102,8 @@ destroy_plugin (ply_boot_splash_plugin_t *plugin)
if (plugin == NULL)
return;
remove_handlers (plugin);
/* It doesn't ever make sense to keep this plugin on screen
* after exit
*/

View file

@ -245,6 +245,7 @@ destroy_plugin (ply_boot_splash_plugin_t *plugin)
if (plugin == NULL)
return;
remove_handlers (plugin);
if (plugin->loop != NULL)
{

View file

@ -126,6 +126,8 @@ destroy_plugin (ply_boot_splash_plugin_t *plugin)
if (plugin == NULL)
return;
remove_handlers (plugin);
if (plugin->loop != NULL)
{
ply_event_loop_stop_watching_for_exit (plugin->loop, (ply_event_loop_exit_handler_t)

View file

@ -107,6 +107,8 @@ destroy_plugin (ply_boot_splash_plugin_t *plugin)
if (plugin == NULL)
return;
remove_handlers (plugin);
/* It doesn't ever make sense to keep this plugin on screen
* after exit
*/