From: David N. (Yeti) <ye...@ph...> - 2005-06-23 07:40:58
|
On Wed, Jun 22, 2005 at 05:25:01PM -0700, Christopher Anderson wrote: > On 6/22/05, Christopher Anderson <sid...@gm...> wrote: > > Let's say I have something like this code: > > > > some_function > > { > > GwyDataField *dfield; > > dfield = GWY_DATA_FIELD(gwy_data_field_new(256, 256, 100, 100, TRUE)); > > > > /* Do stuff with dfield */ > > > > g_object_unref(dfield); > > } > > > > It seems perfectly sane and innocent, but every time I do something > > like this, it causes gwyddion to crash right after my module exits. I > > tried waiting until the very end of the program to unref dfield (after > > making it global), and this seemed to work. Is there some reason why I > > can't create and destroy a datafield within a self-contained function? > > Any idea what's going on here? > > I tried turning off the gwy_debug_objects: > > gwy_debug_objects_enable(FALSE); > > When I do this, the problem goes away, and everything works fine. > Could this be a bug in gwy_debug_objects code? Well, I can't entirely rule out this possibility, but we are talking about less than 30 lines of pretty trivial code. I'm also unable to reproduce any of described problems, valgrind doesn't show anything either. Can you get a stack trace? If it crashes in debug_objects_set_time() -- which consists of one line of code -- what's the value of data? Does it match what is passed to g_object_weak_ref()? It's also possible you overwrite stack or heap somewhere else and only see the consequences here. Yeti -- A: Because it messes up the order in which people normally read text. Q: Why is top-posting such a bad thing? A: Top-posting. Q: What is the most annoying thing on usenet and in e-mail? |