Created attachment 1209 [details]
one basic way to fix it
Claws Mail 3.9.0, plugin clamd 3.5.5
It's possible to make Claws Mail crash always upon opening the Clamav Plugin Preferences after having fiddled with the plugin configuration.
Steps to reproduce:
1. in clawsrc remove all entries in [ClamAV] section
2. start Claws Mail
3. Load clamd plugin, if not loaded already
4. open clamd plugin preferences, enable virus checking + set clamd.conf folder
5. so far so good ;)
6. reopen clamd plugin preferences, disable virus checking
7. unload clamd plugin
8. load clamd plugin again
9. reopen clamd plugin preferences
And it has become impossible to revisit the clamd preferences once more, as unloading/loading the plugin doesn't change a thing. Restarting Claws Mail doesn't fix it either.
In that state, clawsrc contains:
As one can see in the plugin source code, if clamav_enable=0, it creates a NULL clamd config ptr, which it evaluates in the plugin preferences clamav_show_config() method.
Instead of steps 7+8 (unload/load plugin), one can restart Claws Mail, too, of course.
Thanks for your patch. I will however not commit it since your patch only fixes a symptom for a much more serious bug. I have found the bug and more or less provided the proper fix causing the crash you have discovered but it still needs some more testing before I will commit it. The bug was caused by an incomplete state where the plugin was activated before a proper configuration was completed.
That could be true. The patch was really just a hot-fix for the NULL-ptr issue for anyone else who might be interested.
Changes related to this bug have been committed.
Please check latest CVS and update the bug accordingly.
2012-12-16 [michael] 3.5.5cvs2
Fix bug 2838. Numerous changes made due to
plugin in special cases could be activated
with an incomplete configuration.