Ticket #1194 (closed defect: fixed)

Opened 4 years ago

Last modified 4 years ago

null passed to makeNewGObject in handler for setFocusChild

Reported by: guest Owned by: somebody
Priority: normal Milestone: 0.11.0
Component: general (Gtk+, Glib) Version: 0.11.0
Keywords: null setFocusChild Cc:

Description

The following code crashes with

Crash: user error (makeNewGObject: object is NULL)

This happens with gtk-0.11.0 and the latest code from the darcs repository. There is a similar error with Window.onSetFocus/afterSetFocus.

import Graphics.UI.Gtk as Gtk

main = do

initGUI window <- windowNew nb <- notebookNew entry1 <- entryNew entry2 <- entryNew

set nb [ containerChild := entry1,

containerChild := entry2 ]

set window [ containerBorderWidth := 8,

windowTitle := "Crash Me", containerChild := nb ]

-- apparently the widget in this signal can be null on nb setFocusChild $ \w -> widgetGetName w >>= putStrLn >> return ()

widgetGrabFocus entry1 notebookNextPage nb -- CRASH!

widgetShowAll window mainGUI

Attachments

Crash.hs (0.5 kB) - added by guest 4 years ago.
Test.hs (0.6 kB) - added by guest 4 years ago.
Test new patch
gtk2hs-patch-bug1194.diff (0.8 kB) - added by guest 4 years ago.
patch

Change History

Changed 4 years ago by guest

Changed 4 years ago by guest

Test new patch

Changed 4 years ago by guest

patch

Changed 4 years ago by guest

I've attached a patch and a test.

- Dusty DeWeese?

Changed 4 years ago by axel

  • status changed from new to closed
  • resolution set to fixed

Patch applied, thanks!

This will break the API but I'm hesitant to keep a buggy function.

Note: See TracTickets for help on using tickets.