Yet more information on shutdown b0rkenness

Derek Atkins warlord@MIT.EDU
25 Nov 2001 16:06:01 -0500


Here's what appears to be going on...  Due to user input,
we call gnc_shutdown().  Fine.  That calls out to Scheme's
gnc:shutdown.  So far so good.

Next, gnc:shutdown does some scheme stuff and eventually
calls into gnc_file_quit().

Now, here's where life get's interesting.  You see, gnc_file_quit
calls gnc_gui_refresh_all() which eventually leads to
gnc_default_currency() which calls gnc_option_db_lookup_currency_option().
Now this calls out to a scheme function (I can't tell which one
because it's obtained by a lookup function).  And this is where
the problem is.  Whatever is being called eventually calls
gnc_get_current_book().

Unfortunately, by this time, the book() has already been destroyed, as
has the session.  And voila, we've got ourselves into a nice loop
where the book needs the session to emit an event, and the session
needs the book (because it just does).

Here is the gdb trace showing what's going on (starting at
gnc_shutdown).  Hopefully someone who knows more about the shutdown
C<->Scheme interactions can track it down using this information.

-derek

#0  gnc_book_new () at gnc-book.c:104
#1  0x402fc279 in gnc_session_init (session=0x80f63f8) at gnc-session.c:122
#2  0x402fc2cd in gnc_session_new () at gnc-session.c:135
#3  0x40309680 in gnc_get_current_session_internal () at gnc-file.c:73
#4  0x40944155 in gnc_get_current_session () at gnc-ui-util.c:217
#5  0x40944179 in gnc_get_current_book () at gnc-ui-util.c:225
#6  0x40e7ea7e in gwrap_gnc_get_current_book () at gw-app-utils.c:105
#7  0x4003d6ee in scm_deval (x=1088309232, env=1092382808) at eval.c:2636
#8  0x4003d8c4 in scm_deval (x=1088309160, env=1092382808) at eval.c:2720
#9  0x4003d8c4 in scm_deval (x=1088309088, env=1092382808) at eval.c:2720
#10 0x4003f3b4 in scm_dapply (proc=1088394176, arg1=10612, args=1092382832)
    at eval.c:3473
#11 0x40039d36 in scm_apply (proc=1088394128, arg1=10612, args=10612)
    at eval.c:3283
#12 0x400459bc in gh_call0 (proc=1088394128) at gh_funcs.c:150
#13 0x4094a94d in gnc_option_db_lookup_currency_option (odb=0x81ca270, 
    section=0x4094ae6c "International", name=0x4094ae5b "Default Currency", 
    default_value=0x0) at option-util.c:2144
#14 0x4094166d in gnc_lookup_currency_option (
    section=0x4094ae6c "International", name=0x4094ae5b "Default Currency", 
    default_value=0x0) at global-options.c:338
#15 0x4094169b in gnc_default_currency () at global-options.c:356
#16 0x4027e605 in gnc_main_window_summary_refresh (summary=0x82b7308)
    at window-main-summarybar.c:376
---Type <return> to continue, or q <return> to quit---
#17 0x409424de in gnc_gui_refresh_internal (force=1)
    at gnc-component-manager.c:647
#18 0x409425a6 in gnc_gui_refresh_all () at gnc-component-manager.c:669
#19 0x4030a4da in gnc_file_quit () at gnc-file.c:728
#20 0x40e88bb2 in gwrap_gnc_file_quit () at gw-app-file.c:88
#21 0x4003d6ee in scm_deval (x=1088558464, env=1092386232) at eval.c:2636
#22 0x4003f3b4 in scm_dapply (proc=1088579592, arg1=10612, args=1092386384)
    at eval.c:3473
#23 0x40039d36 in scm_apply (proc=1092386496, arg1=1088558312, args=1075777560)
    at eval.c:3283
#24 0x4003a7e2 in scm_for_each (proc=1092386496, arg1=1091505536, args=10612)
    at eval.c:3675
#25 0x4003e8bb in scm_deval (x=10612, env=1092386792) at eval.c:3054
#26 0x4003b678 in scm_deval (x=1088560344, env=1092387208) at eval.c:1954
#27 0x4003f3b4 in scm_dapply (proc=1088559880, arg1=10612, args=1092387208)
    at eval.c:3473
#28 0x40039d36 in scm_apply (proc=1088559744, arg1=2, args=1075777560)
    at eval.c:3283
#29 0x400459ea in gh_call1 (proc=1088559744, arg=2) at gh_funcs.c:156
#30 0x4027d1d1 in gnc_shutdown (exit_status=0) at window-main.c:86


-- 
       Derek Atkins, SB '93 MIT EE, SM '95 MIT Media Laboratory
       Member, MIT Student Information Processing Board  (SIPB)
       URL: http://web.mit.edu/warlord/    PP-ASEL-IA     N1NWH
       warlord@MIT.EDU                        PGP key available