summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJuergen Keil <jkeil@users.sourceforge.net>2002-10-03 17:46:29 +0000
committerJuergen Keil <jkeil@users.sourceforge.net>2002-10-03 17:46:29 +0000
commite2265990ccad2f2f31851d23cf2050712e7d12f1 (patch)
treefbf3bfe8951994ae9b032b5c1d1cd6722af70596 /src
parent48d70003df79adad4807d85d8e66b5e60063750a (diff)
downloadxine-lib-e2265990ccad2f2f31851d23cf2050712e7d12f1.tar.gz
xine-lib-e2265990ccad2f2f31851d23cf2050712e7d12f1.tar.bz2
Slightly reorganize xine_exit, so that "xine --help" does not segfault any more.
xine --help is using xine_exit() on a structure that has not been xine_init'ed. CVS patchset: 2776 CVS date: 2002/10/03 17:46:29
Diffstat (limited to 'src')
-rw-r--r--src/xine-engine/xine.c42
1 files changed, 24 insertions, 18 deletions
diff --git a/src/xine-engine/xine.c b/src/xine-engine/xine.c
index 95ae918d9..75416701a 100644
--- a/src/xine-engine/xine.c
+++ b/src/xine-engine/xine.c
@@ -17,7 +17,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*
- * $Id: xine.c,v 1.161 2002/09/22 14:29:40 mroi Exp $
+ * $Id: xine.c,v 1.162 2002/10/03 17:46:29 jkeil Exp $
*
* top-level xine functions
*
@@ -603,38 +603,44 @@ void xine_exit (xine_t *this) {
int i;
- this->status = XINE_STATUS_QUIT;
+ /* skip some cleanup steps, when xine_init wasn't run */
+ if (this->video_driver && this->metronom) {
- xine_stop(this);
+ /* cleanup things from xine_init... */
+ this->status = XINE_STATUS_QUIT;
- pthread_mutex_lock (&this->finished_lock);
+ xine_stop(this);
- if (this->finished_thread_running)
- pthread_join (this->finished_thread, NULL);
+ pthread_mutex_lock (&this->finished_lock);
- pthread_mutex_unlock (&this->finished_lock);
+ if (this->finished_thread_running)
+ pthread_join (this->finished_thread, NULL);
- printf ("xine_exit: shutdown audio\n");
+ pthread_mutex_unlock (&this->finished_lock);
- audio_decoder_shutdown (this);
+ printf ("xine_exit: shutdown audio\n");
- printf ("xine_exit: shutdown video\n");
+ audio_decoder_shutdown (this);
- video_decoder_shutdown (this);
+ printf ("xine_exit: shutdown video\n");
- this->osd_renderer->close( this->osd_renderer );
- this->video_out->exit (this->video_out);
- this->video_fifo->dispose (this->video_fifo);
+ video_decoder_shutdown (this);
- this->status = XINE_STATUS_QUIT;
+ this->osd_renderer->close( this->osd_renderer );
+ this->video_out->exit (this->video_out);
+ this->video_fifo->dispose (this->video_fifo);
- printf ("xine_exit: bye!\n");
+ this->metronom->exit (this->metronom);
+
+ printf ("xine_exit: bye!\n");
+ }
+
+ /* cleanup things from xine_new... */
+ this->status = XINE_STATUS_QUIT;
for (i = 0; i < XINE_LOG_NUM; i++)
this->log_buffers[i]->dispose (this->log_buffers[i]);
- this->metronom->exit (this->metronom);
-
dispose_plugins (this);
xine_profiler_print_results ();
this->config->dispose(this->config);