-
-
Notifications
You must be signed in to change notification settings - Fork 138
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
[bug] SIGSEGV: Segment Violation with Progress Bar #819
Comments
@xEricL, I can't reproduce Here is the code I'm using package main
import (
"bytes"
"embed"
"image"
"image/png"
"github.com/AllenDang/giu"
)
//go:embed assets/*
var assets embed.FS
var (
logo *image.RGBA
window *giu.MasterWindow
)
func main() {
window = giu.NewMasterWindow(
"Updater",
377, 144,
giu.MasterWindowFlagsFrameless|giu.MasterWindowFlagsNotResizable|giu.MasterWindowFlagsTransparent,
)
logo, _ = loadImage(assets, "assets/logo.png")
window.Run(defaultUI)
}
func defaultUI() {
giu.SingleWindow().Layout(
giu.Align(giu.AlignCenter).To(
giu.Dummy(0, scaleDivider(6)),
giu.ImageWithRgba(logo).Size(80, 80),
giu.Dummy(0, scaleDivider(6)),
giu.ProgressBar(ReadProgress()).Size(scaleValueX(377)*0.75, scaleValueY(5)),
),
)
}
func ReadProgress() float32 {
return 0.5
}
func scaleDivider(value float32) float32 {
_, yScale := giu.Context.Backend().ContentScale()
if yScale > 1.0 {
value *= 2
}
return value * yScale
}
func scaleValueY(value int) float32 {
_, yScale := giu.Context.Backend().ContentScale()
return float32(value) * yScale
}
func scaleValueX(value int) float32 {
xScale, _ := giu.Context.Backend().ContentScale()
return float32(value) * xScale
}
func loadImage(assets embed.FS, path string) (*image.RGBA, error) {
data, err := assets.ReadFile(path)
if err != nil {
return nil, err
}
img, err := png.Decode(bytes.NewReader(data))
if err != nil {
return nil, err
}
return giu.ImageToRgba(img), nil
} It works fine (assets/logo.png for me is examples/loadimage/gopher.png) I've a suggestion for your project: make sure your |
@gucio321 I've made sure to update my style.go. I've pushed the updated code to a new branch https://github.com/alpine-client/pinnacle/tree/giu-v0.8 I didn't think styling was the issue because it still happens even if I removed After further testing, I've discovered 2 cases where the SIGSEV does not happen (which should narrow down the issue):
Let me further explain our program. It basically downloads and unzips Java 17, downloads a Since you're unable to recreate it, please clone this branch, run Please let me know if you're still unable to recreate it under these conditions. The issue is most likely related to |
Even if I comment out the progress bar and only load the image by itself, the SIGSEV occurs. It is almost certainly caused by |
Replacing |
Image with url is almost the same as image with rgba iirc |
@xEricL I'm sorry but I'm still unable to reproduce: giudebug2.mp4 |
That is very interesting. I just tested it in a Debian 11 Virtual Machine and it compiled and ran no problem. Perhaps it's just an issue with Fedora 40 or maybe even just a problem with my system. Thank you for the video and for taking the time to look into this. |
@xEricL I'm on fedora 39. I can check on f40 laptop later. You use wayland or xorg? And what gpu? |
I'm on xorg. GPU is NVIDIA 2060S. |
@xEricL I managed to reproduce on fedora 40 laptop with nvidia gpu. |
fedora 40 PC with no gpu - still works for me. This must be something about gpu (but why?) |
It likely has something to do with NVIDIA drivers for Fedora 40. Very weird that |
Same issue here. Fixed by switching from ImageWithRgbaWidget to ImageWithFileWidget. Apple M1 Pro.
|
@terranvigil what gpu? |
It's the integrated Apple GPU, 16 core |
I had a chat on discord with someone who has similar issue. Turns out it happens independently to codepackage main
import (
"fmt"
"image"
g "github.com/AllenDang/giu"
)
var (
rgba *image.RGBA
)
func loop() {
g.SingleWindow().Layout(
g.Label("Display image from rgba"),
g.ImageWithRgba(rgba).OnClick(func() {
fmt.Println("rgba image was clicked")
}).Size(200, 100),
)
}
func main() {
rgba, _ = g.LoadImage("./fallback.png")
wnd := g.NewMasterWindow("Load Image", 600, 500, 0)
wnd.Run(loop)
} @terranvigil could you confirm? |
I proposed a simple solution to the imageWithRgba issue there, that work flawlessy for me. Gone from 2gb gpu vram (or crash) down to 60Mb |
What happend?
This code worked in v0.7. Updating to v0.8.1 causes a segment violation at runtime.
Code example
main.go
You can also find the actual code I'm using this for here: https://github.com/alpine-client/pinnacle/blob/084fde184a816b2241c36bd4f37a9fced3f21dbf/ui/ui.go#L83
To Reproduce
Version
(latest)
OS
Fedora 40
The text was updated successfully, but these errors were encountered: