Text widget dying



For some reason, this function is causing my
program to die:

void log(log_type type, char *message, ...)
{
   GdkColor color;
   va_list args;
   char fmtmsg[MAX_STR_LEN];
   char *logmsg;
      
   memset(&color, 0, sizeof(color));
   switch(type)
   {
      case LOG_ERR:
         color.red = 0xE665;
         break;
      case LOG_RCV:
         color.blue = 0xCCCC;
         break;
      case LOG_SND:
         color.green = 0x7FFF;
         break;
      default:
         break;
   }

   va_start(args, message);
   vsprintf(fmtmsg, message, args);
   va_end(args);
   
   /* Hide the passwords */
   if(strncmp(fmtmsg, "PASS", 4) == 0)
   {
      logmsg = malloc(15);
      strcpy(logmsg, "PASS ********\n");
   }
   else
   {
      logmsg = &fmtmsg[0];
   }
/*
   gtk_text_freeze(GTK_TEXT(log_win));
   gtk_text_insert(GTK_TEXT(log_win), NULL, &color, NULL, logmsg, -1);
   gtk_text_set_point(GTK_TEXT(log_win),
gtk_text_get_length(GTK_TEXT(log_win))$
   gtk_text_thaw(GTK_TEXT(log_win));
   gtk_adjustment_set_value(GTK_TEXT(log_win)->vadj,
                            GTK_TEXT(log_win)->vadj->upper);
*/
} 


It's the function I use to log FTP data. Somewhere
in the commented-out area, something is causing my
program to die. Here's an example backtrace:

#0  0x401d0caa in _XFlushInt () from /usr/X11R6/lib/libX11.so.6
#1  0x401d0c5b in _XFlush () from /usr/X11R6/lib/libX11.so.6
#2  0x401b77df in _XFlushGCCache () from /usr/X11R6/lib/libX11.so.6
#3  0x401cdf68 in XDrawString () from /usr/X11R6/lib/libX11.so.6
#4  0x4014db15 in gdk_draw_text_wc () from /usr/lib/libgdk-1.2.so.0
#5  0x400ec89e in undraw_cursor () from /usr/lib/libgtk-1.2.so.0
#6  0x400e748d in gtk_text_adjustment () from /usr/lib/libgtk-1.2.so.0
#7  0x400a5b4d in gtk_marshal_NONE__NONE () from /usr/lib/libgtk-1.2.so.0
#8  0x400d2fdd in gtk_handlers_run () from /usr/lib/libgtk-1.2.so.0
#9  0x400d2422 in gtk_signal_real_emit () from /usr/lib/libgtk-1.2.so.0
#10 0x400d0575 in gtk_signal_emit () from /usr/lib/libgtk-1.2.so.0
#11 0x4003d5d8 in gtk_adjustment_value_changed () from
/usr/lib/libgtk-1.2.so.0
#12 0x4003d45c in gtk_adjustment_set_value () from
/usr/lib/libgtk-1.2.so.0
#13 0x8052252 in log (type=LOG_SND, message=0x805566f "%s") at func.c:97
#14 0x8051593 in ftp_send_data (cmd=0x80556d0 "PASV\n") at ftp.c:523
#15 0x80517fa in create_data_connection () at ftp.c:684
#16 0x8051b95 in make_list_connection () at ftp.c:629
#17 0x8052524 in get_remote_file_list () at func.c:254
#18 0x8051b64 in file_list_thread (arg=0x404005c0) at ftp.c:611
#19 0x40264eca in pthread_start_thread (arg=0xbf5ffe60) at manager.c:213

What's interesting is that my program is multi-threaded
I thought maybe I needed to compile gthread in, but when
I do that, I get a bunch of other problems.

I'd like to also note that the program works wonderfully
on my computer. Also, I'm having other problems after I
actually get connected to a host and try to navigate around.
I'd like to figure this problem out first, though before
I try and figure that one out. Could this machine just
be messed (because it works fine on my machine) or is
there something I'm not doing right?

Thanks in advance,

+-----------------------------------------------------+
| Jeff "Shippy" Shipman     E-Mail: shippy@cs.nmt.edu |
| Computer Science Major    ICQ: 1786493              |
| New Mexico Institute of Mining and Technology       |
| Homepage: http://www.nmt.edu/~shippy                |
+-----------------------------------------------------+






[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]