summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenjamin Otte <otte@gnome.org>2008-08-27 11:54:19 +0200
committerBenjamin Otte <otte@gnome.org>2008-08-27 11:54:19 +0200
commit6365d5286ffb898fb3049b9e8d1694515c3f39f6 (patch)
tree200a0e2081476000a3d5c074e21d03d679686566
parent7eaefe278f8c486a4435e00e5a5a380b1a93afb8 (diff)
store pointer to NPP in loaders (fixes 16822)
That way we can set the NPP to NULL in the player and loaders get notified of it. This is not a beautiful way (storing a weak ref to the player would likely be better), but I'm lazy right now.
-rw-r--r--src/swfmoz_loader.c14
-rw-r--r--src/swfmoz_loader.h2
-rw-r--r--src/swfmoz_player.c3
3 files changed, 10 insertions, 9 deletions
diff --git a/src/swfmoz_loader.c b/src/swfmoz_loader.c
index 01c0757..98361d6 100644
--- a/src/swfmoz_loader.c
+++ b/src/swfmoz_loader.c
@@ -56,7 +56,7 @@ swfmoz_loader_load (SwfdecLoader *loader, SwfdecPlayer *player,
SwfmozLoader *moz = SWFMOZ_LOADER (loader);
moz->waiting_for_stream = TRUE;
- moz->instance = mozplay->instance;
+ moz->instance = &mozplay->instance;
if (mozplay->initial) {
swfmoz_loader_set_stream (moz, mozplay->initial);
mozplay->initial = NULL;
@@ -68,12 +68,12 @@ swfmoz_loader_load (SwfdecLoader *loader, SwfdecPlayer *player,
combined = swfmoz_player_add_headers (buffer, header_count, header_names,
header_values);
- plugin_post_url_notify (moz->instance, url, NULL, (char *)combined->data,
+ plugin_post_url_notify (*moz->instance, url, NULL, (char *)combined->data,
combined->length, moz);
swfdec_buffer_unref (combined);
} else {
// FIXME: Impossible to set headers here?
- plugin_get_url_notify (moz->instance, url, NULL, moz);
+ plugin_get_url_notify (*moz->instance, url, NULL, moz);
}
}
}
@@ -85,8 +85,8 @@ swfmoz_loader_close (SwfdecStream *stream)
moz->waiting_for_stream = FALSE;
- if (moz->stream)
- plugin_destroy_stream (moz->instance, moz->stream);
+ if (*moz->instance && moz->stream)
+ plugin_destroy_stream (*moz->instance, moz->stream);
}
static void
@@ -116,7 +116,7 @@ swfmoz_loader_set_stream (SwfmozLoader *loader, NPStream *stream)
g_return_if_fail (stream != NULL);
if (!loader->waiting_for_stream) {
- plugin_destroy_stream (loader->instance, stream);
+ plugin_destroy_stream (*loader->instance, stream);
return;
}
@@ -138,7 +138,7 @@ swfmoz_loader_ensure_open (SwfmozLoader *loader)
if (loader->open)
return;
swfdec_loader_set_url (SWFDEC_LOADER (loader), loader->stream->url);
- swfmoz_player_add_loader (loader->instance->pdata, loader);
+ swfmoz_player_add_loader ((*loader->instance)->pdata, loader);
swfdec_stream_open (SWFDEC_STREAM (loader));
loader->open = TRUE;
}
diff --git a/src/swfmoz_loader.h b/src/swfmoz_loader.h
index d1c4e25..177f39e 100644
--- a/src/swfmoz_loader.h
+++ b/src/swfmoz_loader.h
@@ -40,7 +40,7 @@ struct _SwfmozLoader
{
SwfdecLoader parent;
- NPP instance; /* instance we belong to */
+ NPP * instance; /* pointer to instance we belong to or to NULL if we don't belong to any instance */
NPStream * stream; /* stream we do or NULL if not created yet */
gboolean initial; /* we are the initial loader */
diff --git a/src/swfmoz_player.c b/src/swfmoz_player.c
index aee6dce..1040431 100644
--- a/src/swfmoz_player.c
+++ b/src/swfmoz_player.c
@@ -617,7 +617,7 @@ swfmoz_player_loaders_update (GtkListStore *store, GtkTreeIter *iter, SwfdecLoad
}
url = swfdec_loader_get_url (loader);
- player = SWFMOZ_LOADER (loader)->instance->pdata;
+ player = (*SWFMOZ_LOADER (loader)->instance)->pdata;
if (url && SWFMOZ_LOADER (loader)->initial && swfdec_player_get_variables (player)) {
/* This auto-appends the FlashVars to the reported URL. You should be able
* to copy/paste that URL easily without breakage that way
@@ -1001,6 +1001,7 @@ swfmoz_player_remove (SwfmozPlayer *player)
swfdec_gtk_player_set_playing (SWFDEC_GTK_PLAYER (player), FALSE);
swfdec_gtk_player_set_audio_enabled (SWFDEC_GTK_PLAYER (player), FALSE);
swfmoz_dialog_remove (player);
+ player->instance = NULL;
g_object_unref (player);
}