{"id":189,"date":"2008-08-14T22:11:52","date_gmt":"2008-08-14T10:11:52","guid":{"rendered":"https:\/\/www.deltics.co.nz\/blog\/?p=189"},"modified":"2008-08-14T22:18:59","modified_gmt":"2008-08-14T10:18:59","slug":"multicast-bug-fix","status":"publish","type":"post","link":"https:\/\/www.deltics.co.nz\/blog\/posts\/189\/","title":{"rendered":"MultiCast &#8211; Bug Fix"},"content":{"rendered":"<span class=\"rt-reading-time\" style=\"display: block;\"><span class=\"rt-label rt-prefix\">[Estimated Reading Time: <\/span> <span class=\"rt-time\">2<\/span> <span class=\"rt-label rt-postfix\">minutes]<\/span><\/span><p>With apologies to those who have downloaded what I wrongly claimed was the &#8220;final&#8221; version a few days ago, I found an error in one of those last minute &#8220;improvements&#8221; I mentioned.\u00a0 I also took the opportunity to incorporate a couple of refinements that others suggested (thanks CR).<\/p>\n<p>A new version is now available for download and contains the following fixes and changes:<\/p>\n<p><!--more--><\/p>\n<p>1. Most importantly, I had realised that the <em>CheckReferences()<\/em> method would give false errors due to an error I introduced without testing &#8211; it was one of those: &#8220;this is so simple I can&#8217;t possibly have made a mistake&#8221; things.<\/p>\n<p>Shame on me.  \ud83d\ude41<\/p>\n<p>Now might not be the best time to mention that I plan on blogging about my testing framework at some point (I don&#8217;t call it a &#8220;Unit Testing&#8221; framework because it&#8217;s actually a bit more than that)<\/p>\n<p>2. The <strong>Enabled<\/strong> read\/write property is now read-only.\u00a0 To enable or disable an event use the newly added <strong>Enable<\/strong>\/<strong>Disable<\/strong> methods, so where you would previously have written:<\/p>\n<pre class=\"delphi\">  someEvent.Enabled := FALSE;\r\n  try\r\n     \/\/ Do something\r\n  finally\r\n    someEvent.Enabled := TRUE;\r\n  end;<\/pre>\n<p>now use:<\/p>\n<pre class=\"delphi\">  someEvent.Disable;\r\n  try\r\n     \/\/ Do something\r\n  finally\r\n    someEvent.Enable;\r\n  end;<\/pre>\n<p>Originally I was aiming to keep the number of methods on a multicast event to a minimum, but I agreed with CR that this way of controlling the enabled state of an event was a bit &#8220;funky&#8221;.<\/p>\n<p>3. I also agreed with CR that the two <strong>IOn_Destroy<\/strong> interfaces were something of a mess (I wouldn&#8217;t have gone so far as to call them a &#8220;hack&#8221; though! lol) and I realised that the problem that the separation into two interfaces had solved no longer applied in that no longer ever implement the interface directly;\u00a0 I always use the <strong>TOnDestroy<\/strong> class to add <strong>IOn_Destroy<\/strong> support to a class.<\/p>\n<p>Accordingly I have now removed the <strong>IOn_Destroy_<\/strong> interface and extended the <strong>IOn_Destroy<\/strong> interface to expose some additional methods of the encapsulated event (since the event itself is now not exposed directly).<\/p>\n<h3>Impact Analysis<\/h3>\n<p>With the possible exception of the change to the Enabled property, I don&#8217;t believe this should affect any code anyone may have written in the short time that the previous version was available.<\/p>\n<p>And I would be very interested to here from anyone that has taken a look and is considering perhaps using the code in their projects, even if it&#8217;s just to say &#8220;Hi&#8221;.\u00a0 \ud83d\ude42<\/p>\n<p>The version containing these changes may be downloaded below.<\/p>\n<p>[dm]7[\/dm]<\/p>\n<h3>Meanwhile: Source Code Hosting<\/h3>\n<p>Whilst the downloads manager plugin that I&#8217;m using with my WordPress blog is very good, I am looking for a more practical solution to source code hosting.<\/p>\n<p>I&#8217;ve looked at googlecode and sourceforge and one or two others, and they all seem to use SVN.\u00a0 I personally don&#8217;t like SVN.\u00a0 What do other people in my situation do?\u00a0 i.e. they want a source code hosting solution but the tools they use don&#8217;t fit with the popular offerings.<\/p>\n<p>Do I just have to grit my teeth and learn to put up with SVN?<\/p>\n","protected":false},"excerpt":{"rendered":"<p><span class=\"rt-reading-time\" style=\"display: block;\"><span class=\"rt-label rt-prefix\">[Estimated Reading Time: <\/span> <span class=\"rt-time\">2<\/span> <span class=\"rt-label rt-postfix\">minutes]<\/span><\/span> With apologies to those who have downloaded what I wrongly claimed was the &#8220;final&#8221; version a few days ago, I found an error in one of those last minute &#8220;improvements&#8221; I mentioned.\u00a0 I also took the opportunity to incorporate a couple of refinements that others suggested (thanks CR). A new version is now available for [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"jetpack_publicize_message":"","jetpack_is_tweetstorm":false,"jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":[]},"categories":[4],"tags":[292,28,25,37,38],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_shortlink":"https:\/\/wp.me\/p1TKYv-33","jetpack_sharing_enabled":true,"jetpack-related-posts":[{"id":160,"url":"https:\/\/www.deltics.co.nz\/blog\/posts\/160\/","url_meta":{"origin":189,"position":0},"title":"MultiCast Events &#8211; Conclusion","date":"11 Aug 2008","format":false,"excerpt":"Drawing this subject to a close (finally!), here's the concluding post I promised, including the fully documented and finished implementation that has been serving me well for almost 2 years.\u00a0 The finished implementation incorporates a number of refinements to the core framework, and those are what we shall briefly look\u2026","rel":"","context":"In &quot;Delphi&quot;","img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":3037,"url":"https:\/\/www.deltics.co.nz\/blog\/posts\/3037\/","url_meta":{"origin":189,"position":1},"title":"ReRaise Exception Bug in 10.4.1 x86 Compiler","date":"09 Dec 2020","format":false,"excerpt":"I just ran into a very frustrating issue in Delphi 10.4.1 with long-standing, basic functionality that is now broken in certain circumstances. Fortunately there is a work-around in those certain circumstances, but it's not pretty. The Problem: Re-Raising an exception causes an immediate Access Violation error at the raise statement\u2026","rel":"","context":"In &quot;Delphi&quot;","img":{"alt_text":"","src":"https:\/\/i0.wp.com\/www.deltics.co.nz\/blog\/wp-content\/uploads\/image.png?resize=350%2C200&ssl=1","width":350,"height":200},"classes":[]},{"id":147,"url":"https:\/\/www.deltics.co.nz\/blog\/posts\/147\/","url_meta":{"origin":189,"position":2},"title":"MultiCast Events &#8211; Video #2","date":"09 Aug 2008","format":false,"excerpt":"At the end of my last post I described a problem that arises if an object adds handlers to an event and is then destroyed without having removed those handlers.\u00a0 This video demonstrates that problem and also shows a solution provided by the multicast events framework itself. The details of\u2026","rel":"","context":"In &quot;Delphi&quot;","img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":86,"url":"https:\/\/www.deltics.co.nz\/blog\/posts\/86\/","url_meta":{"origin":189,"position":3},"title":"Multicast Events &#8211; Part 1","date":"05 Aug 2008","format":false,"excerpt":"I remember one of the things that got me excited when I first read about the as-then new fangled C# and .NET stuff coming out of Microsoft was the idea that a single event could have multiple handlers. Cutting a long and irrelevant story short, my interest in .NET waned,\u2026","rel":"","context":"In &quot;Delphi&quot;","img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":112,"url":"https:\/\/www.deltics.co.nz\/blog\/posts\/112\/","url_meta":{"origin":189,"position":4},"title":"Multicast Events &#8211; Video Demo 1","date":"07 Aug 2008","format":false,"excerpt":"My second post on multicast events is now up, and here's a video showing the basics. It was also an excuse to get to grips with the video capturing software - CamStudio - (and technique!), which proved to be a frustrating exercise to say the least, but I am quite\u2026","rel":"","context":"In &quot;Delphi&quot;","img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":137,"url":"https:\/\/www.deltics.co.nz\/blog\/posts\/137\/","url_meta":{"origin":189,"position":5},"title":"Multicast Events &#8211; Part 3","date":"09 Aug 2008","format":false,"excerpt":"So far we've seen a multicast event implementation in (fairly limited) action, and dissected the core of it's implementation, which was a fairly dry affair. I also demonstrated a flaw in the initial implementation - a susceptibility to objects adding handlers to events but not removing them when being destroyed.\u00a0\u2026","rel":"","context":"In &quot;Delphi&quot;","img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]}],"_links":{"self":[{"href":"https:\/\/www.deltics.co.nz\/blog\/wp-json\/wp\/v2\/posts\/189"}],"collection":[{"href":"https:\/\/www.deltics.co.nz\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.deltics.co.nz\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.deltics.co.nz\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.deltics.co.nz\/blog\/wp-json\/wp\/v2\/comments?post=189"}],"version-history":[{"count":2,"href":"https:\/\/www.deltics.co.nz\/blog\/wp-json\/wp\/v2\/posts\/189\/revisions"}],"predecessor-version":[{"id":191,"href":"https:\/\/www.deltics.co.nz\/blog\/wp-json\/wp\/v2\/posts\/189\/revisions\/191"}],"wp:attachment":[{"href":"https:\/\/www.deltics.co.nz\/blog\/wp-json\/wp\/v2\/media?parent=189"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.deltics.co.nz\/blog\/wp-json\/wp\/v2\/categories?post=189"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.deltics.co.nz\/blog\/wp-json\/wp\/v2\/tags?post=189"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}