***Break*** Segmentation Violation - TGraph

Hello all,
I’ve installed 6.12/04 on my Ubutu 16.04LTS.
I’m trying to make a TGraph of the value of the Sin (x) ’ Integral, but it doesn’t work and I don’t know why. Here’s the error message

> 
 *** Break *** segmentation violation



===========================================================
There was a crash.
This is the entire stack trace of all threads:
===========================================================
#0  0x00007f3c4842d07a in __GI___waitpid (pid=5075, stat_loc=stat_loc
entry=0x7fffaa8cfd80, options=options
entry=0) at ../sysdeps/unix/sysv/linux/waitpid.c:29
#1  0x00007f3c483a5fbb in do_system (line=<optimized out>) at ../sysdeps/posix/system.c:148
#2  0x00007f3c49b5476d in TUnixSystem::StackTrace() () from /home/utente/Scrivania/root/lib/libCore.so
#3  0x00007f3c49b56dac in TUnixSystem::DispatchSignals(ESignals) () from /home/utente/Scrivania/root/lib/libCore.so
#4  <signal handler called>
#5  0x0000000000403d44 in Random::Rand01() ()
#6  0x0000000000403bae in Integratore::Media(unsigned int) ()
#7  0x0000000000402e44 in main ()
===========================================================


The lines below might hint at the cause of the crash.
You may get help by asking at the ROOT forum http://root.cern.ch/forum.
Only if you are really convinced it is a bug in ROOT then please submit a
report at http://root.cern.ch/bugs. Please post the ENTIRE stack trace
from above as an attachment in addition to anything else
that might help us fixing this issue.
===========================================================
#5  0x0000000000403d44 in Random::Rand01() ()
#6  0x0000000000403bae in Integratore::Media(unsigned int) ()
#7  0x0000000000402e44 in main ()
#include "TApplication.h"
#include "TCanvas.h"
#include "TGraph.h"
#include "TAxis.h"

using namespace std;

int main(){
	TApplication app ("app", 0, 0);

	TGraph grafico;
	
	FunzioneBase* Sin=new Sinusoide();

	Integratore X (0, 3.141592, Sin);
	
	double n=0.;
	int j=0;
	for(unsigned int i=100; i<10000; i+=100 , j++){
		n=X.Media(i);
		grafico=(j, i, n);
	}
	
	TCanvas* c1=new TCanvas;

	c1->cd();
	grafico.Draw("A*");

app.Run(true);

Hi,

some issue can be hidden in your Sinusoide, FunzioneBase or Integratore but for sure this syntax is wrong:

grafico=(j, i, n);

The right method to invoke is TGraph::SetPoint

Cheers,
Danilo

I noticed grafico=(j, i, n) right after posting the topic and fixed it but that wasn’t my (only) error in the code.
Not sure how to fix this
Thanks!

Hi,

what is the minimal program which I could also run without your classes and that reproduces the issue?

D

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.