Hello Bob,

Thanks for your response. I think you'll find if you access a member of X
from foo() that it will crash, or at least print garbage. For example:

class X
    X() : m_i (123) {}
    virtual ~X() {}

    int foo()   { return this->m_i; }
    int m_i;

Again, it's probably me.  I updated my class to match yours:
class X
    int     m_i;

    X() : m_i(123) {}
    virtual ~X() {}

    int foo()   { return this->m_i; }
recompiled and tried again:
Python 2.7.2 (default, Jun 20 2011, 09:53:03) [MSC v.1500 64 bit (AMD64)] on win
Type "help", "copyright", "credits" or "license" for more information.
>>> import swigtest
[44766 refs]
>>> def GetX():
...     return swigtest.GetXs().front()
[44788 refs]
>>> GetX().foo()
[44883 refs]
The debug version must not be doing something that the release builds are.  At any rate, I would have suggested the same thing Stephan did, just that you assign the return value so its reference count is not lowered before you access it.

Sorry I couldn't help.  :)

Render me gone,                       |||
Bob                                 ^(===)^
   "One of the penalties for refusing to participate in politics is that you
           end up being governed by your inferiors." -- Plato