Irssi doesn't seem to handle overlapping keyboard_entry_redirect calls correctly
Skywing <[email protected]> Sat, 12 Jul 2008 12:47:05 -0500
| Newsgroups | gmane.network.silc.devel,gmane.network.irc.irssi.devel |
|---|---|
| Message-ID | <982D8D05B6407A49AD506E6C3AC8E7D66150B24CA4@caralain.haven.nynaeve.net> |
--===============0257741942==
Content-Language: en-US
Content-Type: multipart/alternative;
boundary="_000_982D8D05B6407A49AD506E6C3AC8E7D66150B24CA4caralainhaven_"
--_000_982D8D05B6407A49AD506E6C3AC8E7D66150B24CA4caralainhaven_
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: quoted-printable
Hi,
If there are multiple overlapping calls to keyboard_entry_redirect() made w=
hile one redirect request is in progress, it seems that memory for all call=
backs except the most recent one is leaked.
sig_gui_entry_redirect() in fe-text/gui-readline.c will not handle the case=
where "redir" is already valid.
Worse, the old callbacks will never get called, which may break the state o=
f anything depending on the callback being eventually called. Furthermore =
there seems to be no mechanism to signal a failure from keyboard_entry_redi=
rect(), thus the API interface is a bit broken as there's no simple way to =
handle this right now.
Individual irssi plugins can work around this by keeping track of their out=
standing calls to keyboard_entry_redirect and making sure that there's neve=
r >1 overlapping call, but if another irssi plugin, or irssi itself, were t=
o call keyboard_entry_redirect(), then this breaks down.
I ran into this while rewriting some of the keyboard prompt code for the si=
lc plugin for irssi. I am working around this by making sure the silc plug=
in never calls keyboard_entry_redirect in an overlapped fashion, but we are=
still a bit hosed if somebody else calls it while we have an outstanding r=
equest in flight.
This really needs to be addressed in the irssi core.
(This is based off of irssi 0.8.12.)
- S
--_000_982D8D05B6407A49AD506E6C3AC8E7D66150B24CA4caralainhaven_
Content-Type: text/html; charset="us-ascii"
Content-Transfer-Encoding: quoted-printable
<html xmlns:v=3D"urn:schemas-microsoft-com:vml" xmlns:o=3D"urn:schemas-micr=
osoft-com:office:office" xmlns:w=3D"urn:schemas-microsoft-com:office:word" =
xmlns:x=3D"urn:schemas-microsoft-com:office:excel" xmlns:p=3D"urn:schemas-m=
icrosoft-com:office:powerpoint" xmlns:a=3D"urn:schemas-microsoft-com:office=
:access" xmlns:dt=3D"uuid:C2F41010-65B3-11d1-A29F-00AA00C14882" xmlns:s=3D"=
uuid:BDC6E3F0-6DA3-11d1-A2A3-00AA00C14882" xmlns:rs=3D"urn:schemas-microsof=
t-com:rowset" xmlns:z=3D"#RowsetSchema" xmlns:b=3D"urn:schemas-microsoft-co=
m:office:publisher" xmlns:ss=3D"urn:schemas-microsoft-com:office:spreadshee=
t" xmlns:c=3D"urn:schemas-microsoft-com:office:component:spreadsheet" xmlns=
:oa=3D"urn:schemas-microsoft-com:office:activation" xmlns:html=3D"http://ww=
w.w3.org/TR/REC-html40" xmlns:q=3D"http://schemas.xmlsoap.org/soap/envelope=
/" xmlns:D=3D"DAV:" xmlns:x2=3D"http://schemas.microsoft.com/office/excel/2=
003/xml" xmlns:ois=3D"http://schemas.microsoft.com/sharepoint/soap/ois/" xm=
lns:dir=3D"http://schemas.microsoft.com/sharepoint/soap/directory/" xmlns:d=
s=3D"http://www.w3.org/2000/09/xmldsig#" xmlns:dsp=3D"http://schemas.micros=
oft.com/sharepoint/dsp" xmlns:udc=3D"http://schemas.microsoft.com/data/udc"=
xmlns:xsd=3D"http://www.w3.org/2001/XMLSchema" xmlns:sub=3D"http://schemas=
.microsoft.com/sharepoint/soap/2002/1/alerts/" xmlns:ec=3D"http://www.w3.or=
g/2001/04/xmlenc#" xmlns:sp=3D"http://schemas.microsoft.com/sharepoint/" xm=
lns:sps=3D"http://schemas.microsoft.com/sharepoint/soap/" xmlns:xsi=3D"http=
://www.w3.org/2001/XMLSchema-instance" xmlns:udcxf=3D"http://schemas.micros=
oft.com/data/udc/xmlfile" xmlns:wf=3D"http://schemas.microsoft.com/sharepoi=
nt/soap/workflow/" xmlns:mver=3D"http://schemas.openxmlformats.org/markup-c=
ompatibility/2006" xmlns:m=3D"http://schemas.microsoft.com/office/2004/12/o=
mml" xmlns:mrels=3D"http://schemas.openxmlformats.org/package/2006/relation=
ships" xmlns:ex12t=3D"http://schemas.microsoft.com/exchange/services/2006/t=
ypes" xmlns:ex12m=3D"http://schemas.microsoft.com/exchange/services/2006/me=
ssages" xmlns:Z=3D"urn:schemas-microsoft-com:" xmlns=3D"http://www.w3.org/T=
R/REC-html40">
<head>
<META HTTP-EQUIV=3D"Content-Type" CONTENT=3D"text/html; charset=3Dus-ascii"=
>
<meta name=3DGenerator content=3D"Microsoft Word 12 (filtered medium)">
<style>
<!--
/* Font Definitions */
@font-face
{font-family:"Cambria Math";
panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0in;
margin-bottom:.0001pt;
font-size:11.0pt;
font-family:"Calibri","sans-serif";}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:blue;
text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
{mso-style-priority:99;
color:purple;
text-decoration:underline;}
span.EmailStyle17
{mso-style-type:personal-compose;
font-family:"Calibri","sans-serif";
color:windowtext;}
.MsoChpDefault
{mso-style-type:export-only;}
@page Section1
{size:8.5in 11.0in;
margin:1.0in 1.0in 1.0in 1.0in;}
div.Section1
{page:Section1;}
-->
</style>
<!--[if gte mso 9]><xml>
<o:shapedefaults v:ext=3D"edit" spidmax=3D"1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext=3D"edit">
<o:idmap v:ext=3D"edit" data=3D"1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang=3DEN-US link=3Dblue vlink=3Dpurple>
<div class=3DSection1>
<p class=3DMsoNormal>Hi,<o:p></o:p></p>
<p class=3DMsoNormal><o:p> </o:p></p>
<p class=3DMsoNormal>If there are multiple overlapping calls to
keyboard_entry_redirect() made while one redirect request is in progress, i=
t
seems that memory for all callbacks except the most recent one is leaked.<o=
:p></o:p></p>
<p class=3DMsoNormal><o:p> </o:p></p>
<p class=3DMsoNormal>sig_gui_entry_redirect() in fe-text/gui-readline.c wil=
l not
handle the case where “redir” is already valid.<o:p></o:p></p>
<p class=3DMsoNormal><o:p> </o:p></p>
<p class=3DMsoNormal>Worse, the old callbacks will never get called, which =
may
break the state of anything depending on the callback being eventually call=
ed.
Furthermore there seems to be no mechanism to signal a failure from
keyboard_entry_redirect(), thus the API interface is a bit broken as there&=
#8217;s
no simple way to handle this right now.<o:p></o:p></p>
<p class=3DMsoNormal><o:p> </o:p></p>
<p class=3DMsoNormal>Individual irssi plugins can work around this by keepi=
ng
track of their outstanding calls to keyboard_entry_redirect and making sure
that there’s never >1 overlapping call, but if another irssi plugi=
n,
or irssi itself, were to call keyboard_entry_redirect(), then this breaks d=
own.<o:p></o:p></p>
<p class=3DMsoNormal><o:p> </o:p></p>
<p class=3DMsoNormal>I ran into this while rewriting some of the keyboard p=
rompt
code for the silc plugin for irssi. I am working around this by makin=
g sure
the silc plugin never calls keyboard_entry_redirect in an overlapped fashio=
n,
but we are still a bit hosed if somebody else calls it while we have an
outstanding request in flight.<o:p></o:p></p>
<p class=3DMsoNormal><o:p> </o:p></p>
<p class=3DMsoNormal>This really needs to be addressed in the irssi core.<o=
:p></o:p></p>
<p class=3DMsoNormal><o:p> </o:p></p>
<p class=3DMsoNormal>(This is based off of irssi 0.8.12.)<o:p></o:p></p>
<p class=3DMsoNormal><o:p> </o:p></p>
<p class=3DMsoNormal>- S<o:p></o:p></p>
</div>
</body>
</html>
--_000_982D8D05B6407A49AD506E6C3AC8E7D66150B24CA4caralainhaven_--
--===============0257741942==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
_______________________________________________________________________
Info: https://lists.silcnet.org/mailman/listinfo/silc-announce
Archive: https://lists.silcnet.org/pipermail/silc-announce
FAQ: http://silcnet.org/support/faq/
--===============0257741942==--