2005-07-17 [colin] 1.9.12cvs75

* src/privacy.c
		add a PrivacySystem accessor that checks that
		the system cached in a MimeInfo's privacydata
		is still registered. Use this accessor instead
		of directly using data->system. Fixes crashes
		after unloading pgp plugins.
This commit is contained in:
Colin Leroy 2005-07-17 11:40:07 +00:00
parent 81bbc3bf44
commit 57592570b5
4 changed files with 46 additions and 8 deletions

View file

@ -1,3 +1,12 @@
2005-07-17 [colin] 1.9.12cvs75
* src/privacy.c
add a PrivacySystem accessor that checks that
the system cached in a MimeInfo's privacydata
is still registered. Use this accessor instead
of directly using data->system. Fixes crashes
after unloading pgp plugins.
2005-07-17 [colin] 1.9.12cvs74
* src/alertpanel.c

View file

@ -669,3 +669,4 @@
( cvs diff -u -r 1.1.2.1 -r 1.1.2.2 src/plugins/pgpcore/Makefile.am; cvs diff -u -r 1.1.2.3 -r 1.1.2.4 src/plugins/pgpmime/Makefile.am; ) > 1.9.12cvs72.patchset
( cvs diff -u -r 1.9.2.3 -r 1.9.2.4 src/gtk/sslcertwindow.c; ) > 1.9.12cvs73.patchset
( cvs diff -u -r 1.17.2.16 -r 1.17.2.17 src/alertpanel.c; ) > 1.9.12cvs74.patchset
( cvs diff -u -r 1.10.2.5 -r 1.10.2.6 src/privacy.c; ) > 1.9.12cvs75.patchset

View file

@ -11,7 +11,7 @@ MINOR_VERSION=9
MICRO_VERSION=12
INTERFACE_AGE=0
BINARY_AGE=0
EXTRA_VERSION=74
EXTRA_VERSION=75
EXTRA_RELEASE=
EXTRA_GTK2_VERSION=

View file

@ -25,6 +25,14 @@
static GSList *systems = NULL;
PrivacySystem *privacy_data_get_system(PrivacyData *data)
{
/* Make sure the cached system is still registered */
if (data->system && g_slist_find(systems, data->system))
return data->system;
else
return NULL;
}
/**
* Register a new Privacy System
*
@ -53,9 +61,14 @@ void privacy_unregister_system(PrivacySystem *system)
*/
void privacy_free_privacydata(PrivacyData *privacydata)
{
PrivacySystem *system = NULL;
g_return_if_fail(privacydata != NULL);
privacydata->system->free_privacydata(privacydata);
system = privacy_data_get_system(privacydata);
if (!system)
return;
system->free_privacydata(privacydata);
}
/**
@ -73,14 +86,20 @@ gboolean privacy_mimeinfo_is_signed(MimeInfo *mimeinfo)
g_return_val_if_fail(mimeinfo != NULL, FALSE);
if (mimeinfo->privacy != NULL) {
PrivacySystem *system = mimeinfo->privacy->system;
PrivacySystem *system =
privacy_data_get_system(mimeinfo->privacy);
if (system == NULL) {
mimeinfo->privacy = NULL;
goto try_others;
}
if (system->is_signed != NULL)
return system->is_signed(mimeinfo);
else
return FALSE;
}
try_others:
for(cur = systems; cur != NULL; cur = g_slist_next(cur)) {
PrivacySystem *system = (PrivacySystem *) cur->data;
@ -111,7 +130,10 @@ gint privacy_mimeinfo_check_signature(MimeInfo *mimeinfo)
if (mimeinfo->privacy == NULL)
return -1;
system = mimeinfo->privacy->system;
system = privacy_data_get_system(mimeinfo->privacy);
if (system == NULL)
return -1;
if (system->check_signature == NULL)
return -1;
@ -130,7 +152,9 @@ SignatureStatus privacy_mimeinfo_get_sig_status(MimeInfo *mimeinfo)
if (mimeinfo->privacy == NULL)
return SIGNATURE_UNCHECKED;
system = mimeinfo->privacy->system;
system = privacy_data_get_system(mimeinfo->privacy);
if (system == NULL)
return SIGNATURE_UNCHECKED;
if (system->get_sig_status == NULL)
return SIGNATURE_UNCHECKED;
@ -149,7 +173,9 @@ gchar *privacy_mimeinfo_sig_info_short(MimeInfo *mimeinfo)
if (mimeinfo->privacy == NULL)
return g_strdup(_("No signature found"));
system = mimeinfo->privacy->system;
system = privacy_data_get_system(mimeinfo->privacy);
if (system == NULL)
return g_strdup(_("No signature found"));
if (system->get_sig_info_short == NULL)
return g_strdup(_("No information available"));
@ -168,7 +194,9 @@ gchar *privacy_mimeinfo_sig_info_full(MimeInfo *mimeinfo)
if (mimeinfo->privacy == NULL)
return g_strdup(_("No signature found"));
system = mimeinfo->privacy->system;
system = privacy_data_get_system(mimeinfo->privacy);
if (system == NULL)
return g_strdup(_("No signature found"));
if (system->get_sig_info_full == NULL)
return g_strdup(_("No information available"));