simon-git: putty (master): Simon Tatham
Commits to Tartarus hosted VCS
tartarus-commits at lists.tartarus.org
Sun Nov 26 12:09:03 GMT 2017
TL;DR:
4d15d46 Memory leak: free conn->retbuf in uxagentc.c.
90a402c Memory leak: free term->answerback in term_free().
f1eeeff Memory leak: add a columns_finalize() method.
9909077 Make the current code compile again under GTK1.
c74d1e3 GTK1 runtime fix: widen extent of ignore_sbar.
116dac2 Reinstate the SIGCHLD handler in ptermapp.
5b13a1b Add a missing conf_copy in gtkapp's Duplicate Session.
b6b91b8 OS X makefile: stop depending on JHBUILD_PREFIX.
99bdaa7 gtkapp.c: fix a copy-paste error in stub main().
afa9734 New facility for removing pending toplevel callbacks.
94a2904 GTK: add a delete_inst() function to clean up a gui_data.
817e4ad Make the configuration dialog non-modal.
7891cb1 Remove an item from gtkapp.c's OS X TODO comment.
Repository: https://git.tartarus.org/simon/putty.git
On the web: https://git.tartarus.org/?p=simon/putty.git
Branch updated: master
Committer: Simon Tatham <anakin at pobox.com>
Date: 2017-11-26 12:09:03
commit 4d15d46473907515d31cd0dc92b3ce86e5c5cb1e
web diff https://git.tartarus.org/?p=simon/putty.git;a=commitdiff;h=4d15d46473907515d31cd0dc92b3ce86e5c5cb1e;hp=0a0a1c01d7cc6ca750d39f43b902e86987c5d376
Author: Simon Tatham <anakin at pobox.com>
Date: Sun Nov 26 08:45:19 2017 +0000
Memory leak: free conn->retbuf in uxagentc.c.
While debugging some new code, I ran valgrind in leak-checking mode
and it pointed out a handful of existing memory leaks, which got in the
way of spotting any _new_ leaks I might be introducing :-)
This was one: in the case where an asynchronous agent query on Unix is
aborted, the dynamically allocated buffer holding the response was not
freed.
unix/uxagentc.c | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
commit 90a402c017b6b262b0b2181cf193dd8188fac5c7
web diff https://git.tartarus.org/?p=simon/putty.git;a=commitdiff;h=90a402c017b6b262b0b2181cf193dd8188fac5c7;hp=4d15d46473907515d31cd0dc92b3ce86e5c5cb1e
Author: Simon Tatham <anakin at pobox.com>
Date: Sun Nov 26 08:45:37 2017 +0000
Memory leak: free term->answerback in term_free().
Not a large leak as these things go, but valgrind's error dump for a
memory leak is just as annoying regardless of the size of the leaked
object!
terminal.c | 1 +
1 file changed, 1 insertion(+)
commit f1eeeff8cfea1001a1791ba95782ba7bbed3b976
web diff https://git.tartarus.org/?p=simon/putty.git;a=commitdiff;h=f1eeeff8cfea1001a1791ba95782ba7bbed3b976;hp=90a402c017b6b262b0b2181cf193dd8188fac5c7
Author: Simon Tatham <anakin at pobox.com>
Date: Sun Nov 26 08:45:45 2017 +0000
Memory leak: add a columns_finalize() method.
My custom GTK layout class 'Columns' includes a linked list of
dynamically allocated data, and apparently I forgot to write a
destructor that frees it all when the class is deallocated, and have
never noticed until now.
unix/gtkcols.c | 55 +++++++++++++++++++++++++++++++++++++++++++++++++++++--
1 file changed, 53 insertions(+), 2 deletions(-)
commit 9909077be131c5dc7b3dee14cb25b8a799040616
web diff https://git.tartarus.org/?p=simon/putty.git;a=commitdiff;h=9909077be131c5dc7b3dee14cb25b8a799040616;hp=f1eeeff8cfea1001a1791ba95782ba7bbed3b976
Author: Simon Tatham <anakin at pobox.com>
Date: Sun Nov 26 08:56:16 2017 +0000
Make the current code compile again under GTK1.
Apparently I haven't tested this compile mode in a while: I had a
couple of compile errors due to new code not properly #ifdeffed (the
true-colour mode has to be effectively disabled in the palette-based
GTK1 graphics model) and one for an unused static function
(get_monitor_geometry is only used in GTK2 and above, and with -Werror
that means I mustn't even _define_ it in GTK1).
With these changes, I still didn't get a clean compile unless I also
configured CFLAGS=-std=gnu89, due to the GTK1 headers having an
outdated set of ifdefs to figure out the compiler's semantics of
'inline'. (They seem to expect old-style gcc, which inconveniently
treats 'inline' and 'extern inline' more or less the opposite way
round from the version standardised by C99.)
unix/gtkwin.c | 12 ++++++++++++
1 file changed, 12 insertions(+)
commit c74d1e3c6a0aa2c4ef275e18fcdc5844f536bab6
web diff https://git.tartarus.org/?p=simon/putty.git;a=commitdiff;h=c74d1e3c6a0aa2c4ef275e18fcdc5844f536bab6;hp=9909077be131c5dc7b3dee14cb25b8a799040616
Author: Simon Tatham <anakin at pobox.com>
Date: Sun Nov 26 09:16:22 2017 +0000
GTK1 runtime fix: widen extent of ignore_sbar.
ignore_sbar is a flag that we set while manually changing the
scrollbar settings, so that when those half-finished changes trigger
GTK event callbacks, we know to ignore them, and wait until we've
finished setting everything up before actually updating the window.
But somehow I had managed to leave the functions that actually _have
the effect_ (at least in GTK1) outside the pair of statements that set
and unset the ignore flag.
The effect was that compiling pterm for GTK1, starting it up, and
issuing a command like 'ls -l' that scrolls off the bottom of the
window would lead to the _top_ half of the ls output being visible,
and the scrollbar at the top of the scrollback rather than the bottom.
unix/gtkwin.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
commit 116dac29ccc99ff498edd7dfcda0f456ce47c3ef
web diff https://git.tartarus.org/?p=simon/putty.git;a=commitdiff;h=116dac29ccc99ff498edd7dfcda0f456ce47c3ef;hp=c74d1e3c6a0aa2c4ef275e18fcdc5844f536bab6
Author: Simon Tatham <anakin at pobox.com>
Date: Sat Nov 25 21:49:31 2017 +0000
Reinstate the SIGCHLD handler in ptermapp.
Detecting that the child process in a pterm has terminated is
important for _any_ kind of pterm, so it's a mistake to put the signal
handler setup _solely_ inside the optional pty_pre_init function which
does the privileged setup and forks off a utmp watchdog process. Now
the signal handler is installed even in the GtkApplication-based
multi-window front end to pterm, meaning it will exist even on OS X.
unix/uxpty.c | 19 ++++++++++++++++---
1 file changed, 16 insertions(+), 3 deletions(-)
commit 5b13a1b01518c23f38525ec2ae9b4ac9ca3110cd
web diff https://git.tartarus.org/?p=simon/putty.git;a=commitdiff;h=5b13a1b01518c23f38525ec2ae9b4ac9ca3110cd;hp=116dac29ccc99ff498edd7dfcda0f456ce47c3ef
Author: Simon Tatham <anakin at pobox.com>
Date: Sat Nov 25 21:51:45 2017 +0000
Add a missing conf_copy in gtkapp's Duplicate Session.
Without this, the Conf objects in a session and its duplicate were
aliases of each other, which could lead to confusing semantic effects
if one of the sessions was reconfigured in mid-run, and worse still, a
crash if one session got cleaned up and called conf_free on a Conf
that the other was still using.
None of that was intentional; it was just a matter of forgetting to
clone the Conf for the duplicated session. Now we do.
unix/gtkapp.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
commit b6b91b8e177958d870caa116e10cec537892eba8
web diff https://git.tartarus.org/?p=simon/putty.git;a=commitdiff;h=b6b91b8e177958d870caa116e10cec537892eba8;hp=5b13a1b01518c23f38525ec2ae9b4ac9ca3110cd
Author: Simon Tatham <anakin at pobox.com>
Date: Sun Nov 26 10:58:56 2017 +0000
OS X makefile: stop depending on JHBUILD_PREFIX.
People who use a packaging system other than jhbuild still ought to be
able to run the OS X GTK3 build, so now the gtk-mac-bundler command
finds out the locations of things by a more portable method.
(I've had this change lurking around uncommitted in a working tree for
a while, and only just found it in the course of doing other OS X-
related work. Oops.)
Recipe | 4 ++--
unix/pterm.bundle | 6 +++++-
unix/putty.bundle | 36 +++++++++++++++++++++++++++++++++++-
3 files changed, 42 insertions(+), 4 deletions(-)
commit 99bdaa7752df6c8feb27ca1de60a463433d43be4
web diff https://git.tartarus.org/?p=simon/putty.git;a=commitdiff;h=99bdaa7752df6c8feb27ca1de60a463433d43be4;hp=b6b91b8e177958d870caa116e10cec537892eba8
Author: Simon Tatham <anakin at pobox.com>
Date: Sat Nov 25 21:55:17 2017 +0000
gtkapp.c: fix a copy-paste error in stub main().
Apparently I copied that rather too literally from osxlaunch.c, where
the text about OS X and 'launcher' made more sense. The stub main in
gtkapp.c has nothing to do with launchers and OS X, so I've corrected
the wording to say that a completely different thing won't work in
completely different circumstances :-)
unix/gtkapp.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
commit afa9734b7de6656fd8db0b077f00f39d8218a4c6
web diff https://git.tartarus.org/?p=simon/putty.git;a=commitdiff;h=afa9734b7de6656fd8db0b077f00f39d8218a4c6;hp=99bdaa7752df6c8feb27ca1de60a463433d43be4
Author: Simon Tatham <anakin at pobox.com>
Date: Sat Nov 25 17:17:21 2017 +0000
New facility for removing pending toplevel callbacks.
This is used when you're about to destroy an object that is
(potentially) the context parameter for some still-pending toplevel
callback. It causes callbacks.c to go through its pending list and
delete any callback records referring to that context parameter, so
that when you destroy the object those callbacks aren't still waiting
to cause stale-pointer dereferences.
callback.c | 65 +++++++++++++++++++++++++++++++++++++++++++++++---------------
putty.h | 1 +
2 files changed, 51 insertions(+), 15 deletions(-)
commit 94a2904ab606ace64db968c95cd0d9d34cf26164
web diff https://git.tartarus.org/?p=simon/putty.git;a=commitdiff;h=94a2904ab606ace64db968c95cd0d9d34cf26164;hp=afa9734b7de6656fd8db0b077f00f39d8218a4c6
Author: Simon Tatham <anakin at pobox.com>
Date: Sun Nov 26 11:50:49 2017 +0000
GTK: add a delete_inst() function to clean up a gui_data.
This has been logically necessary in principle for ages, but we got
away without it because we just exited the program. But in the multi-
window GtkApplication front ends, we can't get away with that for
ever; we need to be able to free _one_ of our 'struct gui_data'
instances and everything dangling off it (or, at least, everything
that GTK's reference counting system doesn't clean up for us), without
also doing anything global to the process in which that gui_data is
contained.
unix/gtkwin.c | 47 ++++++++++++++++++++++++++++++++++++++++++++---
1 file changed, 44 insertions(+), 3 deletions(-)
commit 817e4ad2dd39d2390c85e2e9d6dcb39524b37653
web diff https://git.tartarus.org/?p=simon/putty.git;a=commitdiff;h=817e4ad2dd39d2390c85e2e9d6dcb39524b37653;hp=94a2904ab606ace64db968c95cd0d9d34cf26164
Author: Simon Tatham <anakin at pobox.com>
Date: Sun Nov 26 11:58:02 2017 +0000
Make the configuration dialog non-modal.
Now every call to do_config_box is replaced with a call to
create_config_box, which returns immediately having constructed the
new GTK window object, and is passed a callback function which it will
arrange to be called when the dialog terminates (whether by OK or by
Cancel). That callback is now what triggers the construction of a
session window after 'Open' is pressed in the initial config box, or
the actual mid-session reconfiguration action after 'Apply' is pressed
in a Change Settings box.
We were already prepared to ignore the re-selection of 'Change
Settings' from the context menu of a window that already had a Change
Settings box open (and not accidentally create a second config box for
the same window); but now we do slightly better, by finding the
existing config box and un-minimising and raising it, in case the user
had forgotten it was there.
That's a useful featurelet, but not the main purpose of this change.
The mani point, of course, is that now the multi-window GtkApplication
based front ends now don't do anything confusing to the nesting of
gtk_main() when config boxes are involved. Whether you're changing the
settings of one (or more than one) of your already-running sessions,
preparing to start up a new PuTTY connection, or both at once, we stay
in the same top-level instance of gtk_main() and all sessions' top-
level callbacks continue to run sensibly.
unix/gtkapp.c | 33 +++++++++++++----
unix/gtkdlg.c | 111 +++++++++++++++++++++++++++++++++------------------------
unix/gtkmain.c | 68 +++++++++++++++++++++++++----------
unix/gtkwin.c | 76 +++++++++++++++++++++++++++------------
unix/unix.h | 16 +++++++--
unix/uxpterm.c | 11 +++---
unix/uxputty.c | 7 ++--
7 files changed, 217 insertions(+), 105 deletions(-)
commit 7891cb1ac10938c2d6cf8b88b29eae8cdc0c8633
web diff https://git.tartarus.org/?p=simon/putty.git;a=commitdiff;h=7891cb1ac10938c2d6cf8b88b29eae8cdc0c8633;hp=817e4ad2dd39d2390c85e2e9d6dcb39524b37653
Author: Simon Tatham <anakin at pobox.com>
Date: Sun Nov 26 11:58:05 2017 +0000
Remove an item from gtkapp.c's OS X TODO comment.
The last few changes between them have fixed the problem of windows
not closing properly when their sessions terminated. The problem was
really more than one problem - pterm session termination wasn't even
detected due to the missing SIGCHLD handler, window-closing wasn't
done explicitly due to exit_callback() just calling gtk_main_quit
instead of a proper gtk_widget_destroy(), and that in turn wouldn't do
quite the right thing without the g_application_{hold,release} system
which I added in gtkapp.c as part of the non-model config box rework.
Now that all of those are fixed, things seem to be working sensibly;
the OS X Pterm.app and PuTTY.app, and the ordinary X GTK ptermapp and
puttyapp too, now allow windows to be closed independently of each
other, close them automatically in the right way, and automatically
terminate the whole application when the last window is gone.
So I can clean up that TODO item, including its handwavy 'need to work
out some kind of mechanism'. Some kind of mechanism has now been
worked out, and given that there turned out to be a whole cluster of
interacting structural issues, no wonder I wasn't _quite_ sure what it
ought to be!
unix/gtkapp.c | 15 ---------------
1 file changed, 15 deletions(-)
More information about the tartarus-commits
mailing list