Commit 311544e3 authored by Jean-Paul Saman's avatar Jean-Paul Saman

Defenitely fixed segmentation fault on directory change.

parent 71bd3efe
......@@ -2,7 +2,7 @@
* callbacks.c : Callbacks for the Familiar Linux Gtk+ plugin.
*****************************************************************************
* Copyright (C) 2000, 2001 VideoLAN
* $Id: callbacks.c,v 1.17 2002/12/17 21:04:49 jpsaman Exp $
* $Id: callbacks.c,v 1.18 2002/12/20 21:33:40 jpsaman Exp $
*
* Authors: Jean-Paul Saman <jpsaman@wxs.nl>
*
......@@ -119,9 +119,9 @@ void ReadDirectory( GtkCList *clist, char *psz_dir )
{
intf_thread_t *p_intf = GtkGetIntf( GTK_WIDGET(clist) );
struct dirent **namelist;
int n,status;
int n=-1, status=-1;
msg_Dbg(p_intf, "changing to dir %s\n", psz_dir);
msg_Dbg(p_intf, "changing to dir %s", psz_dir);
if (psz_dir)
{
status = chdir(psz_dir);
......@@ -134,18 +134,23 @@ void ReadDirectory( GtkCList *clist, char *psz_dir )
perror("scandir");
else
{
gchar *ppsz_text[2];
int i;
// msg_Dbg( p_intf, "updating interface" );
gtk_clist_freeze( clist );
gtk_clist_clear( clist );
for (i=0; i<n; i++)
{
gchar *ppsz_text[5];
/* This is a list of strings. */
ppsz_text[0] = namelist[i]->d_name;
ppsz_text[1] = get_file_perm(namelist[i]->d_name);
ppsz_text[2] = "";
ppsz_text[3] = "";
ppsz_text[4] = "";
// msg_Dbg(p_intf, "(%d) file: %s permission: %s", i, ppsz_text[0], ppsz_text[1] );
gtk_clist_insert( clist, i, ppsz_text );
gtk_clist_insert( GTK_CLIST(clist), i, ppsz_text );
free(namelist[i]);
}
gtk_clist_thaw( clist );
......@@ -467,6 +472,8 @@ on_clistmedia_select_row (GtkCList *clist,
gint ret;
struct stat st;
if (!p_intf->p_sys->p_clist)
msg_Err(p_intf, "p_clist pointer is invalid.");
ret = gtk_clist_get_text (p_intf->p_sys->p_clist, row, 0, text);
if (ret)
{
......
......@@ -2,7 +2,7 @@
* familiar.c : familiar plugin for vlc
*****************************************************************************
* Copyright (C) 2002 VideoLAN
* $Id: familiar.c,v 1.17 2002/12/17 21:04:49 jpsaman Exp $
* $Id: familiar.c,v 1.18 2002/12/20 21:33:40 jpsaman Exp $
*
* Authors: Jean-Paul Saman <jpsaman@wxs.nl>
*
......@@ -60,6 +60,10 @@ static int Manage ( intf_thread_t *p_intf );
#define AUTOPLAYFILE_LONGTEXT N_("automatically play a file when selected in the "\
"file selection list")
#ifndef NEED_GTK_MAIN
#define NEED_GTK_MAIN
#endif
/*****************************************************************************
* Module descriptor
*****************************************************************************/
......@@ -87,6 +91,7 @@ static int Open( vlc_object_t *p_this )
}
#ifdef NEED_GTK_MAIN
msg_Dbg( p_intf, "Using gtk_main" );
p_intf->p_sys->p_gtk_main = module_Need( p_this, "gtk_main", "gtk" );
if( p_intf->p_sys->p_gtk_main == NULL )
{
......@@ -117,6 +122,7 @@ static void Close( vlc_object_t *p_this )
}
#ifdef NEED_GTK_MAIN
msg_Dbg( p_intf, "Releasin gtk_main" );
module_Unneed( p_intf, p_intf->p_sys->p_gtk_main );
#endif
......@@ -143,14 +149,17 @@ static void Run( intf_thread_t *p_intf )
#ifdef HAVE_GPE_INIT_H
/* Initialize GPE interface */
msg_Dbg( p_intf, "Starting familiar GPE interface" );
if (gpe_application_init(&i_args, &pp_args) == FALSE)
exit (1);
#else
gtk_set_locale ();
#ifndef NEED_GTK_MAIN
msg_Dbg( p_intf, "Starting familiar GTK+ interface" );
gtk_init( &i_args, &pp_args );
#else
/* Initialize Gtk+ */
msg_Dbg( p_intf, "Starting familiar GTK+ interface thread" );
gdk_threads_enter();
#endif
#endif
......@@ -207,6 +216,7 @@ static void Run( intf_thread_t *p_intf )
* keyboard events, a 100ms delay is a good compromise */
i_dummy = gtk_timeout_add( INTF_IDLE_SLEEP / 1000, (GtkFunction)Manage,
p_intf );
/* Enter Gtk mode */
gtk_main();
/* Remove the timeout */
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment