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

Error with ram #176

Open
Sznymo opened this issue May 3, 2023 · 5 comments
Open

Error with ram #176

Sznymo opened this issue May 3, 2023 · 5 comments

Comments

@Sznymo
Copy link

Sznymo commented May 3, 2023

Error with ram still exists I checked and on Ubuntu and Arch

code:
import nigui
app.init()
var window = newWindow("Test")
window.width = 600.scaleToDpi
window.height = 400.scaleToDpi
var container = newLayoutContainer(Layout_Vertical)
window.add(container)
var button_remove = newButton("Button Test Remove")
var button_1 = newButton("Button Test 1")
var button_2 = newButton("Button Test 2")
var button_3 = newButton("Button Test 3")
var button_4 = newButton("Button Test 4")
var button_5 = newButton("Button Test 5")
var button_6 = newButton("Button Test 6")
var button_7 = newButton("Button Test 7")
var button_8 = newButton("Button Test 8")
var button_9 = newButton("Button Test 9")
var button_10 = newButton("Button Test 10")
container.add(button_remove)
container.add(button_1)
container.add(button_2)
container.add(button_3)
container.add(button_4)
container.add(button_5)
container.add(button_6)
container.add(button_7)
container.add(button_8)
container.add(button_9)
container.add(button_10)

button_remove.onClick = proc(event: ClickEvent) =
container.remove(button_1)
container.remove(button_2)
container.remove(button_3)
container.remove(button_4)
container.remove(button_5)
container.remove(button_6)
container.remove(button_7)
container.remove(button_8)
container.remove(button_9)
container.remove(button_10)

window.show()
app.run()
gscreenshot_2023-05-03-191834
gscreenshot_2023-05-03-191920

@simonkrauter
Copy link
Owner

Strange, I can't reproduce the memory leak any more. Did you compile with the latest fix?
Btw, when you post code here, you can make it look better by adding as first line "```nim" and at the end "```".

I tested with this code:

import nigui

app.init()
var window = newWindow("Test")
window.width = 600.scaleToDpi
window.height = 600.scaleToDpi
var container = newLayoutContainer(Layout_Vertical)
window.add(container)

var button_remove = newButton("Test")

var button_1 = newButton("Button Test 1")
var button_2 = newButton("Button Test 2")
var button_3 = newButton("Button Test 3")
var button_4 = newButton("Button Test 4")
var button_5 = newButton("Button Test 5")
var button_6 = newButton("Button Test 6")
var button_7 = newButton("Button Test 7")
var button_8 = newButton("Button Test 8")
var button_9 = newButton("Button Test 9")
var button_10 = newButton("Button Test 10")

container.add(button_remove)
container.add(button_1)
container.add(button_2)
container.add(button_3)
container.add(button_4)
container.add(button_5)
container.add(button_6)
container.add(button_7)
container.add(button_8)
container.add(button_9)
container.add(button_10)

button_remove.onClick = proc(event: ClickEvent) =
  container.remove(button_1)
  container.remove(button_2)
  container.remove(button_3)
  container.remove(button_4)
  container.remove(button_5)
  container.remove(button_6)
  container.remove(button_7)
  container.remove(button_8)
  container.remove(button_9)
  container.remove(button_10)
  container.add(button_1)
  container.add(button_2)
  container.add(button_3)
  container.add(button_4)
  container.add(button_5)
  container.add(button_6)
  container.add(button_7)
  container.add(button_8)
  container.add(button_9)
  container.add(button_10)

  let childs = container.childControls()
  for child in childs:
    var button = cast[Button](child)
    echo button.text

window.show()
app.run()

@Sznymo
Copy link
Author

Sznymo commented May 3, 2023

yes with the latest version from github.
with the code you posted above I am getting a bunch of errors :
(test:9258): Gtk-CRITICAL **: 20:11:39.241: gtk_layout_move: assertion 'GTK_IS_WIDGET (child_widget)' failed
SIGSEGV: Illegal storage access. (Attempt to read from nil?)
Error: execution of an external program failed: ''/home/user/Projekty/Menager/instalator/Tłumacz/test' '

@simonkrauter
Copy link
Owner

I can't reproduce the SIGSEGV. I have tried Nim 1.6.12 and 2.0 RC1.
Which Nim version do you use? Do you compile for x86-64?
You can try a debug build, maybe the SIGSEGV shows then a line number.

@Sznymo
Copy link
Author

Sznymo commented May 4, 2023

I use nim 1.6.10, yes x64 . I tried it now with nim-1.6.12. same error :(
changing the gtk3 package to an older version of it didn't help either. the leak is still there :( but if it's only with me it's a small problem , come on 2 computers I saw the same error :/.

@Sznymo
Copy link
Author

Sznymo commented May 4, 2023

ps. I noticed that by using "choosenim devel", the leakage is much lower :)

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

No branches or pull requests

2 participants