Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

panic: runtime error: invalid memory address or nil pointer dereference #61

Open
hly0025 opened this issue Jul 26, 2023 · 1 comment
Open

Comments

@hly0025
Copy link

hly0025 commented Jul 26, 2023

I'm getting a runtime error for an invalid memory address.

panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x5d1e74]

goroutine 191 [running]:
github.com/tinyzimmer/go-gst/gst.(*Sample).Instance.func1(0xc001265ca0?)
	/go/pkg/mod/github.com/tinyzimmer/[email protected]/gst/gst_sample.go:34 +0x14
github.com/tinyzimmer/go-gst/gst.(*Sample).Instance(0x7f5b6804d350?)
	/go/pkg/mod/github.com/tinyzimmer/[email protected]/gst/gst_sample.go:34 +0x19
github.com/tinyzimmer/go-gst/gst.(*Sample).GetCaps.func1(0xc001265ec0?)
	/go/pkg/mod/github.com/tinyzimmer/[email protected]/gst/gst_sample.go:60 +0x19
github.com/tinyzimmer/go-gst/gst.(*Sample).GetCaps(0x4b78a5?)
	/go/pkg/mod/github.com/tinyzimmer/[email protected]/gst/gst_sample.go:60 +0x19

Looking into gst_sample.go line 34 and 60 is:

Line 34 here:
// Instance returns the underlying *GstSample instance. func (s *Sample) Instance() *C.GstSample { return C.toGstSample(unsafe.Pointer(s.sample)) }

Line 60 here:
// GetCaps returns the caps associated with this sample. Take a ref if you need to hold on to them // longer then the life of the sample. func (s *Sample) GetCaps() *Caps { return FromGstCapsUnsafeNone(unsafe.Pointer(C.gst_sample_get_caps(s.Instance()))) }

How is it possible that the line 34 and 60 is causing this? I haven't found a way to replicate it, but this happens after running my application after a few hours consistently.

I believe the lines of code that may cause the above is as follows:

	go_sample := sink.PullSample() 
	go_caps_format := my_sample.GetCaps().GetStructureAt(0)
@RSWilli
Copy link

RSWilli commented Aug 24, 2023

@hly0025 move this issue to https://github.com/go-gst/go-gst (where future development of the bindings will take place) if you think it is necessary.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants