Skip to content
Browse files

Fix Pin isconnected property, only cache flag and get from pluginIO (…

…also on constructor)
  • Loading branch information...
1 parent f1f7925 commit 346a039141c42f50a45c3364b8ee2cb1c6436c0e @mrvux mrvux committed
Showing with 5 additions and 4 deletions.
  1. +5 −4 vvvv45/src/core/PluginInterfaces/V2/Pin.cs
View
9 vvvv45/src/core/PluginInterfaces/V2/Pin.cs
@@ -38,13 +38,14 @@ public class Pin<T> : Spread<T>, ISpread<T>, IDisposable
{
private readonly IIOFactory FFactory;
private readonly IPluginIO FPluginIO;
- private int FConnectionCount = 0;
+ private bool FConnected;
public Pin(IIOFactory factory, IPluginIO pluginIO, MemoryIOStream<T> stream)
: base(stream)
{
FFactory = factory;
FPluginIO = pluginIO;
+ FConnected = pluginIO.IsConnected;
FFactory.Connected += HandleConnected;
FFactory.Disconnected += HandleDisconnected;
@@ -63,7 +64,7 @@ public override string ToString()
public bool IsConnected
{
- get { return FConnectionCount > 0; }
+ get { return FConnected; }
}
public IPluginIO PluginIO
@@ -98,7 +99,7 @@ void HandleConnected(object sender, ConnectionEventArgs e)
{
if (e.PluginIO == FPluginIO)
{
- FConnectionCount++;
+ FConnected = this.PluginIO.IsConnected;
OnConnected(new PinConnectionEventArgs(e.OtherPin));
}
}
@@ -107,7 +108,7 @@ void HandleDisconnected(object sender, ConnectionEventArgs e)
{
if (e.PluginIO == FPluginIO)
{
- FConnectionCount--;
+ FConnected = this.PluginIO.IsConnected;
OnDisconnected(new PinConnectionEventArgs(e.OtherPin));
}
}

0 comments on commit 346a039

Please sign in to comment.
Something went wrong with that request. Please try again.