<html>
    <head>
      <base href="https://bugs.documentfoundation.org/">
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_UNCONFIRMED "
   title="UNCONFIRMED - Assertion failed when adding a formula to a sheet with Formulas calculated action"
   href="https://bugs.documentfoundation.org/show_bug.cgi?id=142980">142980</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Assertion failed when adding a formula to a sheet with Formulas calculated action
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>LibreOffice
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>unspecified
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>All
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>All
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>UNCONFIRMED
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>medium
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>Calc
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>libreoffice-bugs@lists.freedesktop.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>mikekaganski@hotmail.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>erack@redhat.com
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Using a dbgutil build:

1. Create this stub macro:

  Sub EmptyOn
  End Sub

2. In a new Calc document, assign it to a sheet's Formulas calculated action
(right-click on the sheet's tab, select "Sheet Events")

3. Select an empty cell, and type into it:

  =1+1

=> debug assertion failed: back() called on empty deque

The failing code is inside '#if OSL_DEBUG_LEVEL > 0' of
UndoManagerHelper_Impl::listActionLeft; it tries to read top of
m_aContextAPIFlags, which is empty at this moment.

The reason is the processing sequence in ScViewFunc::EnterData, which first
calls 'rFunc.EnterListAction( STR_UNDO_ENTERDATA );' before it processes the
formula - at this moment, there's no listeners yet, so the action is not
executed -> UndoManagerHelper_Impl::listActionEntered is not called; then it
processes the formula and calls rFunc.SetFormulaCell - at which moment, a
listener is added; and then it calls rFunc.EndListAction, which tries to call
UndoManagerHelper_Impl::listActionLeft, which relies on
UndoManagerHelper_Impl::listActionEntered being called previously.

But I don't know if simply checking if the stack is empty before the debugging
code is OK - it looks hackish.

Eike: do you have an idea how to improve this?</pre>
        </div>
      </p>


      <hr>
      <span>You are receiving this mail because:</span>

      <ul>
          <li>You are the assignee for the bug.</li>
      </ul>
    </body>
</html>