News:

Use the "Forum Search"
It may help you to find anything in the forum ;).

crash on quitting game with fahrplan_gui opened

Started by wackdone, July 25, 2012, 07:26:17 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

wackdone

The problem is simple;
opening 'schedule editor' and pressing 'Quit game', gets FATAL in vector_tpl.

My patch attached is just an ad hoc workaround, It avoids touching general_tool[] which has been destroyed.

Essential treatment may be: having 'shutting down flag' and karte_t::destroy() marks it true.
Then, everything shall check the flag before critical actions.
But, it'll be a dull way to make codes safe.

Another way (only for this problem) would be:  to keep tools alive while destroying convoys.

prissi

Actually, destroy should have closed all windows beforehand. Hmm.

wackdone

I understood the core of the problem by prissi's comment.
The process of shutting down would have two parts:
  (1) destroying user interfaces
  (2) destroying the game world

The problem of this topic is derived from violation between (1) and (2).
  destroying convoy -> convoy closes UI -> fahrplan editor goes closing.
It will be a right sequence that:
  (1) closing all windows (and cutting all relations between UI and the world)
then
  (2) destroying all resources in the game world

Although, I feel that complete separation may be a little bit overdoing :-)

prissi

#3
The was already the call to close all windows. However it was skipped upon closing via a tool ...

wackdone

#4
Sorry, I didn't see wkz_quit_t codes.
I've found it!

in gui/optionen.cc:
action_triggered() ..

        else if(comp==&bt_quit) {
>>                destroy_all_win( true );   << missing!!
                welt->beenden(true);
        }


It shall call either executing wkz_quit_t, or call destroy_all_win(true) before beenden.
Mmm, excuse me, I've not seen what interferes with this workaround (and what prissi is considering about).

Calling destroy_all_win() looks dangerous at moment.
But the real destruction is delayed by 'inside_event_handling' and 'kill_list' in simwin.cc.

I've tested the bt_quit with destroy_all_win().
It made no problem while shutting down procedure. It works fine.

How about it?

prissi

If you trace the program, the ultimative destroy event is called when the tool are destroyed, just when the loop in sommain.cc is finished. Thus there is the most appropriate location (and I put it there in my commit).

As I usually close by the window edge click, this was left undetected a long time.

wackdone

#6
I've seen your commit.
It is exact place to cut the things down, I think too.
Thank you for teaching me.

And then, calling destroy_all_win() in wkz_quit_t::init() is needless now. Isn't it?

prissi

In principle yes; but it does not hurt either.

wackdone

I've got it.
No need makes no change.
(to make the program stable)

Thank you for kind replies.
Please close the topic as fixed.