<html>
<body>
<div style="font-family: Verdana, Arial, Helvetica, Sans-Serif;">
<table bgcolor="#f9f3c9" width="100%" cellpadding="8" style="border: 1px #c9c399 solid;">
<tr>
<td>
This is an automatically generated e-mail. To reply, visit:
<a href="https://reviewboard.asterisk.org/r/1151/">https://reviewboard.asterisk.org/r/1151/</a>
</td>
</tr>
</table>
<br />
<div>
<table width="100%" border="0" bgcolor="white" style="border: 1px solid #C0C0C0; border-collapse: collapse; margin: 2px padding: 2px;">
<thead>
<tr>
<th colspan="4" bgcolor="#F0F0F0" style="border-bottom: 1px solid #C0C0C0; font-size: 9pt; padding: 4px 8px; text-align: left;">
<a href="https://reviewboard.asterisk.org/r/1151/diff/1/?file=15995#file15995line4861" style="color: black; font-weight: bold; text-decoration: underline;">/trunk/main/features.c</a>
<span style="font-weight: normal;">
(Diff revision 1)
</span>
</th>
</tr>
</thead>
<tbody style="background-color: #e4d9cb; padding: 4px 8px; text-align: center;">
<tr>
<td colspan="4"><pre style="font-size: 8pt; line-height: 140%; margin: 0; ">static int load_config(void)</pre></td>
</tr>
</tbody>
<tbody>
<tr>
<th bgcolor="#b1ebb0" style="border-right: 1px solid #C0C0C0;" align="right"><font size="2"></font></th>
<td bgcolor="#c5ffc4" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "></pre></td>
<th bgcolor="#b1ebb0" style="border-left: 1px solid #C0C0C0; border-right: 1px solid #C0C0C0;" align="right"><font size="2">4847</font></th>
<td bgcolor="#c5ffc4" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; ">                <span class="n">ast_context_destroy</span><span class="p">(</span><span class="n">ast_context_find</span><span class="p">(</span><span class="n">default_parkinglot</span><span class="o">-></span><span class="n">parking_con</span><span class="p">),</span><span class="nb">NULL</span><span class="p">);</span></pre></td>
</tr>
</tbody>
</table>
<pre style="margin-left: 2em; white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">changed to [...], NULL);</pre>
</div>
<br />
<p>- jrose</p>
<br />
<p>On March 28th, 2011, 4:03 p.m., jrose wrote:</p>
<table bgcolor="#fefadf" width="100%" cellspacing="0" cellpadding="8" style="background-image: url('https://reviewboard.asterisk.orgrb/images/review_request_box_top_bg.png'); background-position: left top; background-repeat: repeat-x; border: 1px black solid;">
<tr>
<td>
<div>Review request for Asterisk Developers, Russell Bryant and David Vossel.</div>
<div>By jrose.</div>
<p style="color: grey;"><i>Updated 2011-03-28 16:03:17</i></p>
<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Description </h1>
<table width="100%" bgcolor="#ffffff" cellspacing="0" cellpadding="10" style="border: 1px solid #b8b5a0">
<tr>
<td>
<pre style="margin: 0; padding: 0; white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">What I think is happening:
everything is in features.c unless stated otherwise
within load_config
default_parkinglot = build_parkinglot(...) is ran when there is not already a default_parkinglot, automatically creates context and extension using default data. This is bad, because a little while later...
the config file is loaded and data is populated for creating the context.
The new context is created, so we have a second context in the dialplan which depending on config files may or may not be the same context.
Oh, and also we weren't deleting the contexts/extensions when we changed them.
fix:
First, the context/extension is no longer created in the build_parkinglot method. The wrong context is no longer made and this should be safe since we'll be creating the context soon after that in load_config anyway.
Second, if the default_parkinglot is not null when load_config is invoked (as in, by reload features in CLI), the context belonging to the default_parkinglot before the config file is reparsed gets cleared.
All in all, I think that should fix the problem.
There might be some other code in build_parkinglot which could do with some disposal. I'm afraid to touch a lot of it right now since I don't know what all of it pertains to. Also, anything that just writes to the parkinglot structure should probably be ignored since this just supplies default values.</pre>
</td>
</tr>
</table>
<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Testing </h1>
<table width="100%" bgcolor="#ffffff" cellspacing="0" cellpadding="10" style="border: 1px solid #b8b5a0">
<tr>
<td>
<pre style="margin: 0; padding: 0; white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">I tested the code as it was changed using features.conf and played with extension and context settings. Tried a number of reload features commands and it doesn't seem to break from that. Of course, I also changed features.conf between reloads and left it alone between some other reloads to check if it would behave properly when loading the same context it just destroyed.</pre>
</td>
</tr>
</table>
<div style="margin-top: 1.5em;">
<b style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Bugs: </b>
<a href="https://issues.asterisk.org/view.php?id=18801">18801</a>
</div>
<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Diffs</b> </h1>
<ul style="margin-left: 3em; padding-left: 0;">
<li>/trunk/main/features.c <span style="color: grey">(311734)</span></li>
</ul>
<p><a href="https://reviewboard.asterisk.org/r/1151/diff/" style="margin-left: 3em;">View Diff</a></p>
</td>
</tr>
</table>
</div>
</body>
</html>