Need help with this code.

Bing Zhang bzhang@sohar.com
Thu, 11 Dec 1997 13:56:20 -0800


Hi, 

I am new to the omniOrb and I am trying to port the code from orbix to
omniOrb, so please bear with me for this simple question:

I have the following two interface:

interface counter
{
	void	setCount(in long aValue);
	long	getCount();

	void	incCount();
	void	decCount();
};

interface counterFactory
{
	counter	newCounter();
	void	freeCounter(in counter aCounter);
};

In the implementation file counter_i.cc, I have:

class counter_i : public virtual _sk_counter {
	omni_mutex	mutex;
	CORBA::Long	m_count;
public:
	virtual void	setCount(CORBA::Long aValue);
	virtual CORBA::Long	getCount();

	virtual void	incCount();
	virtual void	decCount();

			counter_i() {};
	virtual		~counter_i();
};

class counterFactory_i : public virtual _sk_counterFactory {
public:
	virtual counter_ptr newCounter();
	virtual void	freeCounter(counter_ptr aCounter);
};

counter_ptr 
counterFactory_i::newCounter()
{
 
	counter_ptr c = new counter_i();
        counter::_duplicate(c);
	return c;
}

........

In the function newCounter(), when the code executes 
counter::_duplicate(c);, it throws out an system exception at client
side.

What is wrong?

Thanks

Bing