/pidgin/main: 7767aaeade64: media: make "init-media" signal hand...
Jakub Adam
jakub.adam at ktknet.cz
Fri Mar 13 19:52:07 EDT 2015
Changeset: 7767aaeade6404396204794f9bc75d9a2cb723f0
Author: Jakub Adam <jakub.adam at ktknet.cz>
Date: 2014-08-12 14:39 +0200
Branch: release-2.x.y
URL: https://hg.pidgin.im/pidgin/main/rev/7767aaeade64
Description:
media: make "init-media" signal handler optional
Change the logic so that the PurpleMedia instance isn't disposed when
"init-media" has no connected handlers.
We want the media object freed only when some signal callback function
explicitly returns FALSE, indicating an error during the initialization.
This is mostly useful for the imminent addition of private media streams.
diffstat:
libpurple/mediamanager.c | 17 +++++++++++------
1 files changed, 11 insertions(+), 6 deletions(-)
diffs (35 lines):
diff --git a/libpurple/mediamanager.c b/libpurple/mediamanager.c
--- a/libpurple/mediamanager.c
+++ b/libpurple/mediamanager.c
@@ -334,7 +334,7 @@ purple_media_manager_create_media(Purple
{
#ifdef USE_VV
PurpleMedia *media;
- gboolean signal_ret;
+ guint signal_id;
media = PURPLE_MEDIA(g_object_new(purple_media_get_type(),
"manager", manager,
@@ -343,12 +343,17 @@ purple_media_manager_create_media(Purple
"initiator", initiator,
NULL));
- g_signal_emit(manager, purple_media_manager_signals[INIT_MEDIA], 0,
- media, account, remote_user, &signal_ret);
+ signal_id = purple_media_manager_signals[INIT_MEDIA];
- if (signal_ret == FALSE) {
- g_object_unref(media);
- return NULL;
+ if (g_signal_has_handler_pending(manager, signal_id, 0, FALSE)) {
+ gboolean signal_ret;
+
+ g_signal_emit(manager, signal_id, 0, media, account, remote_user,
+ &signal_ret);
+ if (signal_ret == FALSE) {
+ g_object_unref(media);
+ return NULL;
+ }
}
manager->priv->medias = g_list_append(manager->priv->medias, media);
More information about the Commits
mailing list