Re: question about double using a thread



On 2001.01.17 03:31:29 +0100 Havoc Pennington wrote:
> 
> Ronald Bultje <rbultje ronald bitfreak net> writes:
> > On 2001.01.16 21:04:21 +0100 Timothy M. Shead wrote:
> > > Ronald Bultje wrote:
> > > 
> > > > I have tried it yesterday.... The application dumps core directly
> at
> > > > startup, I probably am doing something wrong. What? By the way, it
> > > compiles
> > > > fine....
> > > > The code below here is made from pieces of info I found on
> websites, so
> > > > there might be a basic mistake in it.... I am just learning c++, am
> not
> > > > that experienced yet....
> > > > The piece of code that applies to this pipe is below:
> > > 
> > > You need to find out where it's failing - either run the program
> through 
> > > gdb, or add some printf() statements to see what's going wrong.
> > > 
> > > Tim
> > 
> > It fails at the call gtk_main();
> > Here are the last lines of my main(argc,argv[])-function:
> > [.....]
> > gtk_widget_show (window);
> > gtk_main ();
> > return(0);
> > }
> > 
> > it crashes at gtk_main(); I guess it is outside my scope to know what
> in my
> > app could interfere with gtk_main..... Thing is that I see a window
> coming
> > up but it crashes immediately (logical - gtk_widget_show(window) is
> > completed and directly after that, in gtk_main, it crashes....)
> > Anyone?
> > 
> 
> gtk_main() will be on the stacking during nearly all of a GTK
> program. Build both GTK and your program with debugging (-g flag), and 
> look at the first stack frames in the backtrace, not the last ones
> such as gtk_main().
> 
> Havoc
> 
> 

Hmmm. I always build with -g by default :-). No warnings at all (well, one
about "assignment from incompatible pointer type", but it's been there all
time and imho doesn't cause the segfault).
Thing is, that I tried uncommenting everything I do with the pipe. Even
after commenting out all pipe-using functions, it segfaults. It stops
segfaulting after commentin out "FILE *pipe;".
So I looked at some libs in the /usr-directory and saw that every time the
FILE is used, they use "external FILE *<name>;", and after trying that in
my app, it stopped segfaulting (with all functions still commented out).
Now, if I do "pipe = popen(command->str,"w");" again, it still segfaults
(this is the first use of the variable pipe after actually reserving memory
for it by doing "extern FILE *pipe;").
I thought that maybe it segfaults because the pointer has not been
allocated yet (but for some reason, allocation of this variable won't work,
if I make a "extern FILE non-pointer-pipe;", it gives me undefined
references to this variable)... But now, I'm out of good ideas (again)...
Isn't there any way to see what the core is saying?

Well, thanks for all the help until now, I hope you guys have more ideas...

PS I didn't mention this yet: I have redhat 7 (with updates), would that be
a problem on itself?

Ronald Bultje





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