[gtkmm] creating a C callback from a SigC::Slot without a SignalProxy



Hi,

While looking at the Widget class of libbonobouimm, I need some way to
create a C callback from a SigC::Slot. Of course, I could just use
something simple as

void call_slot (Foo *arg1, gpointer user_data)
{
	reinterpret_cast<SigC::Slot1<void, Foo*> > (user_data).call (arg1);
}

void set_callback (SigC::Slot1<void, Foo*> slot)
{
	c_api_set_callback (call_slot, slot);
}

But this will have obvious ownership/lifetime problems (who keeps the slot
around?). So, what's the correct solution for this? (the C API explicitly
requires a (funcptr, closure) tuple and doesn't use signals -- this is
bonobo_widget_new_from_control_async)

Thanks,
	Gergo

-- 
   .--= ULLA! =---------------------.   `We are not here to give users what
   \     http://cactus.rulez.org     \   they want'  -- RMS, at GUADEC 2001
    `---= cactus cactus rulez org =---'
C program elindul.  C program leáll. Írd újra Pascalban!




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]