<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="http://git.reviewboard.kde.org/r/101671/">http://git.reviewboard.kde.org/r/101671/</a>
</td>
</tr>
</table>
<br />
<blockquote style="margin-left: 1em; border-left: 2px solid #d0d0d0; padding-left: 10px;">
<p style="margin-top: 0;">On June 18th, 2011, 11:30 a.m., <b>David Nolden</b> wrote:</p>
<blockquote style="margin-left: 1em; border-left: 2px solid #d0d0d0; padding-left: 10px;">
<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="http://git.reviewboard.kde.org/r/101671/diff/1/?file=24688#file24688line1372" style="color: black; font-weight: bold; text-decoration: underline;">languages/cpp/codecompletion/context.cpp</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; ">QList<CompletionTreeItemPointer> CodeCompletionContext::completionItems(bool& shouldAbort, bool fullCompletion) {</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">1372</font></th>
<td bgcolor="#c5ffc4" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "> <span class="n">ForegroundLock</span> <span class="n">foregroundLock</span><span class="p">;</span> <span class="c1">//Cannot invokeMethod with return across threads till Qt 4.8</span></pre></td>
</tr>
</tbody>
</table>
<pre style="white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">This will cause deadlocks (see the comment at the top of foregroundlock.h), because the duchain-lock is held.
Qt-4.8 won't help too, as it will cause the same deadlock.
You can use the ForegroundLock to get the required information, but you have to move the code out of the context where the duchain-lock is held. You have to make sure that the duchain-objects stay valid for the time you unlock the duchain-lock, you can use IndexedDeclaration or IndexedDUContext or similar for that.
As you have to access the foreground synchronously anyway, you don't need to change DocumentAccess. You can simply do "PersistentMovingRange r = context->createMovingRange(); unlock duchain; ForegroundLock lock; text = r->text();" to get the text</pre>
</blockquote>
<p>On June 18th, 2011, 12:25 p.m., <b>Olivier Jean de Gaalon</b> wrote:</p>
<blockquote style="margin-left: 1em; border-left: 2px solid #d0d0d0; padding-left: 10px;">
<pre style="white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">Ok, I'll rewrite that part accordingly.
BTW, I was referring to this: http://bugreports.qt.nokia.com/browse/QTBUG-10440
Which means that it should be doing the same thing as the DocumentAccess's replaceCurrentAccess function, using a BlockingQueuedConnection.</pre>
</blockquote>
<p>On June 19th, 2011, 6:36 a.m., <b>Olivier Jean de Gaalon</b> wrote:</p>
<blockquote style="margin-left: 1em; border-left: 2px solid #d0d0d0; padding-left: 10px;">
<pre style="white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">Hrm, I don't see how one can get the text from a PersistentMovingRange (no text() function, at least).
Also I get an assert "KDevelop::ForegroundLock::isLockedForThread()" if I attempt to create a PersistentMovingRange without holding the ForegroundLock.
</pre>
</blockquote>
</blockquote>
<pre style="margin-left: 1em; white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">I added the function yesterday</pre>
<br />
<p>- David</p>
<br />
<p>On June 18th, 2011, 4:58 a.m., Olivier Jean de Gaalon wrote:</p>
<table bgcolor="#fefadf" width="100%" cellspacing="0" cellpadding="8" style="background-image: url('http://git.reviewboard.kde.org/media/rb/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 KDevelop.</div>
<div>By Olivier Jean de Gaalon.</div>
<p style="color: grey;"><i>Updated June 18, 2011, 4:58 a.m.</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;">Build a context for the switch AST.
Add a new "case" parent context for cpp code completion to match the type of the switch's expression.
Add test.</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;">Usage, new test.</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="http://bugs.kde.org/show_bug.cgi?id=184185">184185</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>languages/cpp/codecompletion/context.h <span style="color: grey">(08049b8)</span></li>
<li>languages/cpp/codecompletion/context.cpp <span style="color: grey">(c0d6841)</span></li>
<li>languages/cpp/cppduchain/contextbuilder.h <span style="color: grey">(3ab9cdd)</span></li>
<li>languages/cpp/cppduchain/contextbuilder.cpp <span style="color: grey">(b00c9c8)</span></li>
<li>languages/cpp/cpputils.h <span style="color: grey">(b0b633e)</span></li>
<li>languages/cpp/cpputils.cpp <span style="color: grey">(6ac9414)</span></li>
<li>languages/cpp/tests/test_cppcodecompletion.h <span style="color: grey">(7546f7e)</span></li>
<li>languages/cpp/tests/test_cppcodecompletion.cpp <span style="color: grey">(6eb4257)</span></li>
</ul>
<p><a href="http://git.reviewboard.kde.org/r/101671/diff/" style="margin-left: 3em;">View Diff</a></p>
</td>
</tr>
</table>
</div>
</body>
</html>