OpenHome Forum
contentDirectory.PropertyContainerUpdateIDs() crashes - Printable Version

+- OpenHome Forum (http://forum.openhome.org)
+-- Forum: OpenHome (/forumdisplay.php?fid=1)
+--- Forum: Net (/forumdisplay.php?fid=5)
+--- Thread: contentDirectory.PropertyContainerUpdateIDs() crashes (/showthread.php?tid=1088)



contentDirectory.PropertyContainerUpdateIDs() crashes - ChriD - 27-01-2013 02:43 PM

Hi,

I can search and browse via the contentDirectory Object, but if i call
contentDirectory.PropertyContainerUpdateIDs() the system crashes with an Error "Abort() called".

Code:

contentDirectory = new OpenHome.Net.ControlPoint.Proxies.CpProxyUpnpOrgContentDirectory1(_device);
contentDirectory.SetPropertyContainerUpdateIDsChanged(ContainerUpdateIDsSink);
contentDirectory.Subscribe();

protected void ContainerUpdateIDsSink()
{
String updateIds = contentDirectory.PropertyContainerUpdateIDs(); // <-- System crashes
}


I'm using VisualStudio2010 Express C#
OhNet libs (1.0.544) at 24.01.2013

Am i doeing something wrong?


RE: contentDirectory.PropertyContainerUpdateIDs() crashes - simonc - 28-01-2013 11:50 AM

ohNet is asserting because a property value is being queried before being set.

It looks like ContainerUpdateIDs is an optional state variable which isn't implemented by some media servers. It therefore isn't surprising that the initial event from some devices doesn't contain a value for ContainerUpdateIDs. What is surprising is that your property changed callback ran at all; this seems likely to be a bug in ohNet.

I'll look into this. For now, you can assume that your code is reasonable and will work when run against a later release of ohNet.


RE: contentDirectory.PropertyContainerUpdateIDs() crashes - simonc - 28-01-2013 01:39 PM

I've fixed this locally now. The code should make it onto github this evening. If you're blocked and would like a fix sooner, you can apply the following diffs yourself:

diff --git a/OpenHome/Net/Service.cpp b/OpenHome/Net/Service.cpp
index 1c803b3..6d23123 100644
--- a/OpenHome/Net/Service.cpp
+++ b/OpenHome/Net/Service.cpp
@@ -257,7 +257,7 @@ Property::Property(Environment& aEnv, OpenHome::Net::Paramet
: iEnv(aEnv)
, iParameter(aParameter)
, iFunctor(aFunctor)
- , iChanged(true)
+ , iChanged(false)
, iSequenceNumber(0)
{
ASSERT(iParameter != NULL);
@@ -267,7 +267,7 @@ Property::Property(Environment& aEnv, OpenHome::Net::Paramet
Property::Property(Environment& aEnv, OpenHome::Net::Parameter* aParameter)
: iEnv(aEnv)
, iParameter(aParameter)
- , iChanged(true)
+ , iChanged(false)
, iSequenceNumber(0)
{
ASSERT(iParameter != NULL);