Hello, I was trying to create a small Gtk program for my personal use. It has a glib timeout function that reads data from a few spinbuttons, comboboxtext and an entry periodically and automatically refreshes a couple of labels. Here is the app itself: import gintro/[gtk, glib, gobject, gio] import strutils proc updateIntervalResult(builder: Builder): bool = result = true let startAM = builder.getComboBoxText("start_am_pm").getActiveText() == "AM" startHour = builder.getSpinButton("start_hour").getValue() + (if startAM: 0 else: 12) startMin = builder.getSpinButton("start_minute").getValue() endAM = builder.getComboBoxText("end_am_pm").getActiveText() == "AM" endHour = builder.getSpinButton("end_hour").getValue() + (if endAM: 0 else: 12) endMin = builder.getSpinButton("end_minute").getValue() let interval = (endHour * 60 + endMin - startHour * 60 - startMin) / 60 if interval < 0.0: builder.getLabel("interval_label").setLabel("-") builder.getLabel("currency_label").setLabel("-") else: let intervalFormat = interval.formatFloat(ffDecimal, 2) builder.getLabel("interval_label").setLabel(intervalFormat) if builder.getEntry("rate").getTextLength() > uint16(0): try: let rateStr = builder.getEntry("rate").getText() let rate = rateStr.parseFloat() builder.getLabel("currency_label").setLabel(cstring("$" & (interval * rate).formatFloat(ffDecimal, 2))) except: echo "parsing currency failed" builder.getLabel("currency_label").setLabel("$0.00") else: builder.getLabel("currency_label").setLabel(" ") proc appActivate(app: Application) = let builder = newBuilderFromFile("resources/ui.glade") let appWindow = builder.getApplicationWindow("aw") appWindow.setApplication(app) timeoutAdd(400, updateIntervalResult, builder) appWindow.showAll() when isMainModule: let app = newApplication("com.gitlab.adnan338.Interval") app.connect("activate", appActivate) discard run(app) Run
Here is the glade file: <https://pastebin.com/hAFqWm8b> However the app crashes after a few seconds by itself after entering some data saying: Error: unhandled exception: /home/adnan338/.nimble/pkgs/gintro-0.8.3/gintro/gtk.nim(61531, 11) `result.impl == gobj` [AssertionError] What could be causing this? Thanks in advance.