~ubuntu-branches/ubuntu/saucy/monodevelop/saucy-proposed

« back to all changes in this revision

Viewing changes to external/maccore/src/Foundation/NSAction.cs

  • Committer: Package Import Robot
  • Author(s): Jo Shields
  • Date: 2012-06-22 20:35:35 UTC
  • mfrom: (10.3.2)
  • Revision ID: package-import@ubuntu.com-20120622203535-zrozwvcf6kfk6l6i
Tags: 3.0.3.2+dfsg-1
* [3fd89ae] Imported Upstream version 3.0.3.2+dfsg
* [379a680] Remove old patches we haven't used for ages from git.
* [d71161d] Remove correct_paths_in_monodevelop-core-addins.pc.patch.
  Upstream claim to have fixed this by moving assembly install locations.
* [15dbfb9] Fix install location for MonoDevelop.Gettext.dll.config.
* [26eb434] Fix install location for MonoDevelop.SourceEditor2.dll.config.
* [4169974] Upstream commit 53282c9 which finally reconciles the 
  MonoDevelop.Gettext.dll install location with the 
  monodevelop-core-addins.pc location.

Show diffs side-by-side

added added

removed removed

Lines of Context:
21
21
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
22
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
23
23
//
 
24
 
 
25
using System;
24
26
using System.Runtime.InteropServices;
25
27
using MonoMac.ObjCRuntime;
26
28
 
55
57
                GCHandle gch;
56
58
                NSAction action;
57
59
 
 
60
                // This ctor is so that the runtime can create a new instance of this class
 
61
                // if ObjC wants to call release on an instance we've already called Dispose on.
 
62
                // Since we detach the handle from the managed instance when Dispose is called,
 
63
                // there is no way we can get the existing managed instance (which has possibly 
 
64
                // been freed anyway) when ObjC calls release (which ends up in NSObject.NativeRelease).
 
65
                [Obsolete ("Do not use")]
 
66
                public NSAsyncActionDispatcher (IntPtr handle)
 
67
                        : base (handle)
 
68
                {
 
69
                }
 
70
 
58
71
                public NSAsyncActionDispatcher (NSAction action)
59
72
                {
60
73
                        this.action = action;
68
81
                        try {
69
82
                                action ();
70
83
                        } finally {
 
84
                                action = null; // this is a one-shot dispatcher
71
85
                                gch.Free ();
 
86
                                Dispose ();
72
87
                        }
73
88
                }
74
89
        }