On Fri, 2008-12-26 at 03:24 +0800, Cedric Vivier wrote:
...

> Also attached patch fixing the only defect found with self-test:
> 
> Target: System.Void 
> Gendarme.Wizard::SaveReportButtonClick(System.Object,System.EventArgs)
> Assembly: gendarme-wizard, Version=2.3.0.0, Culture=neutral, 
> PublicKeyToken=null
> Severity: Medium  Confidence: Normal
> Source: 
> /home/cedric/dev/workspace/mono/gendarme/gendarme/swf-wizard-runner/Wizard.cs(≈656)
> Details: Local 'writer' is not guaranteed to be disposed.

hmmm... not sure what's the *defect* here ?
> 
> 
> 
> 
> 
> 
> text/x-diff attachment (writer-dispose.patch)
> 
> diff --git a/gendarme/swf-wizard-runner/Wizard.cs 
> b/gendarme/swf-wizard-runner/Wizard.cs
> index 445ae08..72e15e8 100644
> --- a/gendarme/swf-wizard-runner/Wizard.cs
> +++ b/gendarme/swf-wizard-runner/Wizard.cs
> @@ -653,11 +653,8 @@ namespace Gendarme {
>                         if (save_file_dialog.ShowDialog () != DialogResult.OK)
>                                 return;
>  
> -                       ResultWriter writer = GetSelectedWriter 
> (save_file_dialog.FilterIndex, save_file_dialog.FileName);
> -                       if (writer != null) {
> +                       using (var writer = GetSelectedWriter 
> (save_file_dialog.FilterIndex, save_file_dialog.FileName))
>                                 writer.Report ();
> -                               writer.Dispose ();
> -                       }
>                 }

Under which case, using the existing code, will writer avoid to be
disposed ?

Unless I'm missing something (beside sleep ;-) it looks like a false
positive from the rule.

Sebastien


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Gendarme" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/gendarme?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to