I believe I've found the cause of this problem. There's something special (I don't know what) about the exit behavior of GTK+ in the case that there's something on the application's clipboard. With nothing on the clipboard, application exit was fine. With something on the clipboard, aplwrap's apl_exit() was called twice (?) which caused a double-free of plot_pipe_name; that was almost certainly responsible for the heap corruption I saw.
Also, it looked as if the GtkTextBuffer and associated objects got torn down while APL was still alive; this was responsible for a lot of GTK+ assertion failures in my tests. Both of these issues are fixed. I'll send Chris the patch. On Fri, 2014-09-12 at 12:55 -0400, Chris Moller wrote: > Can you run it under valgrind? That should find memory problems. > > > On 09/12/14 12:51, David B. Lamkins wrote: > > > FWIW: commenting out the gtk_text_view_scroll_to_mark() call in > > scroll_to_cursor() does not affect the crash that I'm seeing (which is > > different in its details from the crash that Blake reported). I still > > get a memory corruption report, though... > > > > On Fri, 2014-09-12 at 09:46 -0700, David B. Lamkins wrote: > > > I reached similar conclusions. It seems that copy/paste tickles this > > > bug. > > > > > > Copy, then paste, then evaluate, then click the close box: this is > > > enough to give me GTK+ errors and even stack dumps. > > > > > > These are probably the important clues: > > > > > > GLib-GObject-WARNING **: invalid unclassed pointer in cast to > > > 'GtkTextView' > > > (aplwrap:29325): Gtk-CRITICAL **: gtk_text_view_scroll_to_mark: > > > assertion 'GTK_IS_TEXT_VIEW (text_view)' failed > > > > > > gtk_text_view_scroll_to_mark() appears (in aplwrap code) only in > > > scroll_to_cursor(). Is the cast in that function incorrect? > > > > > > On Fri, 2014-09-12 at 10:47 -0500, Blake McBride wrote: > > > > Here are the steps that reproduce the problem: > > > > > > > > > > > > 1. Execute aplwrap > > > > > > > > > > > > 2. Type the following: > > > > > > > > > > > > ∇test > > > > [1] abc > > > > [2] > > > > > > > > > > > > 3. Highlight and COPY (^C) the 'abc' > > > > > > > > > > > > 4. Click on the end of the [2] line > > > > > > > > > > > > 5. PASTE (^V) the 'abc' (has no quotes) > > > > > > > > > > > > 6. Hit the backspace key 3 times > > > > > > > > > > > > 7. Hit the X in the upper corner to force aplwrap to exit. This > > > > causes the error. > > > > > > > > > > > > Does this give you errors too? > > > > > > > > > > > > Thanks. > > > > > > > > > > > > Blake > > > > > > > > > > > > > > > > On Fri, Sep 12, 2014 at 9:05 AM, Chris Moller <mol...@mollerware.com> > > > > wrote: > > > > > > > > On 09/12/14 09:58, Blake McBride wrote: > > > > > > > > > I am using vanilla LinuxMint 16. GTK comes with it. > > > > > Upgrading to test is sort of a big job that messes up > > > > > auto-update. Let me see if I can get an exact sequence to > > > > > duplicate the problem instead. Is that okay? > > > > > > > > Sure. And I might have a spare machine I can install 3.8.7 on > > > > just to see what happens. > > > > > > > > > > > > > > On Fri, Sep 12, 2014 at 8:49 AM, Chris Moller > > > > > <mol...@mollerware.com> wrote: > > > > > Can you try putting in a newer version? 3.8.7 is > > > > > from November of last year. They've done a lot of > > > > > bug-fixing since then and it would be good to know > > > > > if the bug is on my end or in GTK. > > > > > > > > > > > > > > > > > > > > > > > > > On 09/12/14 09:40, Blake McBride wrote: > > > > > > > > > > > Looks like I am running 3.8.7 > > > > > > > > > > > > On Fri, Sep 12, 2014 at 8:25 AM, Chris Moller > > > > > > <mol...@mollerware.com> wrote: > > > > > > What version of GTK are you using? I'm > > > > > > running 3.10.9 though in configure.ac I'm > > > > > > only checking for versions >= 3.0.12. > > > > > > There may be some incompatibility. > > > > > > > > > > > > > > > > > > > > > > > > On 09/12/14 08:39, Blake McBride wrote: > > > > > > > > > > > > > Greetings, > > > > > > > > > > > > > > > > > > > > > I was in the middle of editing a > > > > > > > function using the regular del-editor, I > > > > > > > copied and pasted a line, I then exited > > > > > > > aplwrap by clicking on the x in the > > > > > > > upper left hand corner of the screen > > > > > > > without closing the function I was > > > > > > > editing. Aplwrap gave me: > > > > > > > > > > > > > > > > > > > > > (aplwrap:29325): Gtk-CRITICAL **: > > > > > > > gtk_main_quit: assertion 'main_loops != > > > > > > > NULL' failed > > > > > > > > > > > > > > > > > > > > > (aplwrap:29325): GLib-GObject-WARNING > > > > > > > **: invalid unclassed pointer in cast to > > > > > > > 'GtkTextView' > > > > > > > > > > > > > > > > > > > > > (aplwrap:29325): Gtk-CRITICAL **: > > > > > > > gtk_text_view_scroll_to_mark: assertion > > > > > > > 'GTK_IS_TEXT_VIEW (text_view)' failed > > > > > > > *** Error in `aplwrap': malloc(): > > > > > > > smallbin double linked list corrupted: > > > > > > > 0x0000000001f88cc0 *** > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > Thanks. > > > > > > > > > > > > > > > > > > > > > Blake > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > >