[MPlayer-cvslog] r33394 - in trunk: gui/interface.c mplayer.c
ib
subversion at mplayerhq.hu
Sat May 7 17:30:15 CEST 2011
Author: ib
Date: Sat May 7 17:30:14 2011
New Revision: 33394
Log:
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().
Modified:
trunk/gui/interface.c
trunk/mplayer.c
Modified: trunk/gui/interface.c
==============================================================================
--- trunk/gui/interface.c Sat May 7 13:11:07 2011 (r33393)
+++ trunk/gui/interface.c Sat May 7 17:30:14 2011 (r33394)
@@ -52,8 +52,6 @@
#include "stream/stream_dvd.h"
#endif
-#define DONE -1
-
guiInterface_t guiIntfStruct;
int guiWinID = -1;
@@ -385,6 +383,7 @@ void guiInit(void)
void guiDone(void)
{
+ if (initialized) {
mplMainRender = 0;
mp_msg(MSGT_GPLAYER, MSGL_V, "[GUI] done.\n");
@@ -405,31 +404,19 @@ void guiDone(void)
cfg_write();
wsXDone();
+ }
- guiExit(DONE);
+ appFreeStruct();
+
+ if (gui_conf) {
+ m_config_free(gui_conf);
+ gui_conf = NULL;
+ }
}
-// NOTE TO MYSELF: Before calling guiInit(), MPlayer calls GUI functions
-// cfg_read() and import_initial_playtree_into_gui(). Only
-// after guiInit() has been called successfully, guiDone()
-// (and thus guiExit()) will be executed by MPlayer on exit.
-// In other words, any MPlayer's exit between cfg_read() and
-// guiInit() will not execute guiDone().
-// With this function it is at least possible to handle
-// GUI's own abortions during (and before) guiInit().
void guiExit(int how)
{
- if (!initialized || (how == DONE)) {
- if (gui_conf) {
- m_config_free(gui_conf);
- gui_conf = NULL;
- }
-
- appFreeStruct();
- }
-
- if (how != DONE)
- exit_player_with_rc(how, how >= EXIT_ERROR);
+ exit_player_with_rc(how, how >= EXIT_ERROR);
}
void guiLoadFont(void)
Modified: trunk/mplayer.c
==============================================================================
--- trunk/mplayer.c Sat May 7 13:11:07 2011 (r33393)
+++ trunk/mplayer.c Sat May 7 17:30:14 2011 (r33394)
@@ -2757,7 +2757,10 @@ int gui_no_filename=0;
parse_cfgfiles(mconfig);
#ifdef CONFIG_GUI
- if ( use_gui ) cfg_read();
+ if ( use_gui ) {
+ initialized_flags|=INITIALIZED_GUI;
+ cfg_read();
+ }
#endif
mpctx->playtree = m_config_parse_mp_command_line(mconfig, argc, argv);
@@ -3018,7 +3021,6 @@ current_module = NULL;
if(use_gui){
guiInit();
guiGetEvent(guiSetContext, mpctx);
- initialized_flags|=INITIALIZED_GUI;
guiGetEvent( guiCEvent,(char *)((gui_no_filename) ? 0 : 1) );
}
#endif
More information about the MPlayer-cvslog
mailing list