Re: Segfault from GTK2.Notebook switch_page signal
Chris Angelico <[email protected]>
| Newsgroups | gmane.comp.lang.pike.user |
|---|---|
| Message-ID | <CAPTjJmrSLXybmBuC3_ZfnuCL6+vg6V7ti2YrRiTboVy6kFqN1w@mail.gmail.com> |
On Sat, Mar 15, 2014 at 11:16 AM, Chris Angelico <[email protected]> wrote: > I can't find many cases where a signal argument uses G_TYPE_POINTER, > but every one I've tested has had the same segfault. So in the > interests of simplicity, I'm looking at turning all such pointers into > integers (see attached patch). Does anyone know of an actual use-case > that needs the Pike object pointer? I put together a little script to try to find signals that use gpointer, and came across three: GTK2.Notebook switch-page, GTK2.MenuItem toggle-size-request, and GTK2.Editable insert-text. There may be others, I don't know (for simplicity, the script checks only classes that can be instantiated with no args). Does anyone use any of those signals with Pike? With Python, the docs for two of them state explicitly that the pointer is useless to Python code; toggle-size-request doesn't say that, but I can't find any info on usefully using it, so it's likely the case there too. Would it be a problem to just turn those into integers? It'd prevent segfaults; currently, this code will crash Pike as soon as you type into the entry field: int main() { GTK2.setup_gtk(); object ef=GTK2.Entry(); GTK2.Window(0)->add(ef)->show_all()->signal_connect("delete-event",lambda() {exit(0);}); ef->signal_connect("insert-text",lambda(mixed ... args) {write("%O\n",args);}); return -1; } With the patch I sent previously, this will happily show five arguments, two of which are quite useless (the length of the incoming string, and the pointer), and won't crash. ChrisA