[PATCH] robustness for GdkEvent.xs



squentin caught me in irc to ask about a crash in GdkEvent.xs. He had Gtk2 1.081 built against gtk+ 2.6.x, but running against 2.8.x. This should be something that Just Works, but he was getting crash because of a GdkEventGrabBroken.

The actual sequence was this:

1. emit event-after
2. handler invoked
3. GClosure.xs tries to marshal the parameters
4. GdkEvent.xs tries to figure out into which package to bless the event
5. gdk_event_get_package() doesn't know about GDK_GRAB_BROKEN, and croaks with "Illegal type %d in event->type". 6. we later crash in gsignal.c because it's really not good to longjmp out of signals.

Now, #6 isn't really what i'm worried about --- we know that exceptions in signals are bad, that's why we eval handlers. #5 is the problem. We need to be robust against this sort of thing, because it's always possible for new versions of gtk+ to add event types, and we shouldn't crash because of it -- we should at least limp along.

The attached patch turns this croak() into a warn, and falls back on blessing the event into the generic Gtk2::Gdk::Event package. It also plugs a memory leak by ensuring that we have Gtk2::Gdk::Event::GrabBroken::DESTROY.

I think this needs to go into HEAD and 1.10x. Should we release a new 1.08x with this for distros that still have 1.08x as the current stable?

Attachment: gdk-event-stuff.patch
Description: Binary data



--
However, like all drugs, PANEXA can produce some notable side effects, all of which are probably really, really terrific and nothing that anyone should be concerned about, let alone notify any medical regulatory commission about.
  -- http://www.panexa.com




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]