#! /usr/bin/env python
import pygtk; pygtk.require("2.0")

import bonobo
import CORBA, sys
import gc

gc.set_debug(gc.DEBUG_LEAK)

orb = CORBA.ORB_init(sys.argv)
bonobo.activate()


def foo(*args):
    print args

listener = bonobo.Listener(foo)

print "server-side boundary"
listener = listener.corba_objref() # from now on we work on client-side
gc.collect()
print "client-side"

print ">>unref listener start"
# this should trigger final ref count -> destroy
listener.unref()
del listener
print "<<unref listener end"
gc.collect()

