Mercurial > mplayer.hg
comparison gui/interface.c @ 33307:552f1f7731c8
Set GUI initialization flag earlier.
So far, the flag is set after the call of guiInit(), but there are calls
to GUI functions (like reading the GUI config) before that. As MPlayer
(when exiting) only calls GUI's cleanup function guiDone() if the flag
is set, it neglects calling guiDone() on any error between the first GUI
function call and execution of guiInit(). Now the flag is set before the
first GUI function call.
As a result, GUI's own exit function (also used for fatal GUI errors, and
thus also for errors occurring before guiInit() properly finishes) doesn't
have to handle cleanup any longer. The code can be moved to guiDone().
author | ib |
---|---|
date | Sat, 07 May 2011 15:30:14 +0000 |
parents | be7d8c249dfd |
children | 0c2f2368a031 |
comparison
equal
deleted
inserted
replaced
33306:37e215798390 | 33307:552f1f7731c8 |
---|---|
50 | 50 |
51 #ifdef CONFIG_DVDREAD | 51 #ifdef CONFIG_DVDREAD |
52 #include "stream/stream_dvd.h" | 52 #include "stream/stream_dvd.h" |
53 #endif | 53 #endif |
54 | 54 |
55 #define DONE -1 | |
56 | |
57 guiInterface_t guiIntfStruct; | 55 guiInterface_t guiIntfStruct; |
58 | 56 |
59 int guiWinID = -1; | 57 int guiWinID = -1; |
60 | 58 |
61 char *skinName; | 59 char *skinName; |
383 initialized = 1; | 381 initialized = 1; |
384 } | 382 } |
385 | 383 |
386 void guiDone(void) | 384 void guiDone(void) |
387 { | 385 { |
386 if (initialized) { | |
388 mplMainRender = 0; | 387 mplMainRender = 0; |
389 | 388 |
390 mp_msg(MSGT_GPLAYER, MSGL_V, "[GUI] done.\n"); | 389 mp_msg(MSGT_GPLAYER, MSGL_V, "[GUI] done.\n"); |
391 | 390 |
392 if (gui_save_pos) { | 391 if (gui_save_pos) { |
403 ass_bottom_margin = gtkASS.bottom_margin; | 402 ass_bottom_margin = gtkASS.bottom_margin; |
404 #endif | 403 #endif |
405 | 404 |
406 cfg_write(); | 405 cfg_write(); |
407 wsXDone(); | 406 wsXDone(); |
408 | 407 } |
409 guiExit(DONE); | 408 |
410 } | 409 appFreeStruct(); |
411 | 410 |
412 // NOTE TO MYSELF: Before calling guiInit(), MPlayer calls GUI functions | 411 if (gui_conf) { |
413 // cfg_read() and import_initial_playtree_into_gui(). Only | 412 m_config_free(gui_conf); |
414 // after guiInit() has been called successfully, guiDone() | 413 gui_conf = NULL; |
415 // (and thus guiExit()) will be executed by MPlayer on exit. | 414 } |
416 // In other words, any MPlayer's exit between cfg_read() and | 415 } |
417 // guiInit() will not execute guiDone(). | 416 |
418 // With this function it is at least possible to handle | |
419 // GUI's own abortions during (and before) guiInit(). | |
420 void guiExit(int how) | 417 void guiExit(int how) |
421 { | 418 { |
422 if (!initialized || (how == DONE)) { | 419 exit_player_with_rc(how, how >= EXIT_ERROR); |
423 if (gui_conf) { | |
424 m_config_free(gui_conf); | |
425 gui_conf = NULL; | |
426 } | |
427 | |
428 appFreeStruct(); | |
429 } | |
430 | |
431 if (how != DONE) | |
432 exit_player_with_rc(how, how >= EXIT_ERROR); | |
433 } | 420 } |
434 | 421 |
435 void guiLoadFont(void) | 422 void guiLoadFont(void) |
436 { | 423 { |
437 #ifdef CONFIG_FREETYPE | 424 #ifdef CONFIG_FREETYPE |