<html>
    <head>
      <base href="https://bugs.webkit.org/" />
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - [GTK] WTF_WorkQueue.Simple test fails due to assumptions about reference count"
   href="https://bugs.webkit.org/show_bug.cgi?id=144824">144824</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>[GTK] WTF_WorkQueue.Simple test fails due to assumptions about reference count
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>WebKit
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>528+ (Nightly build)
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Linux
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>Normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P2
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>Tools / Tests
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>webkit-unassigned&#64;lists.webkit.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>mcatanzaro&#64;igalia.com
          </td>
        </tr></table>
      <p>
        <div>
        <pre>**FAIL** WTF_WorkQueue.Simple

../../Tools/TestWebKitAPI/Tests/WTF/WorkQueue.cpp:57

Value of: initialRefCount

  Actual: 2

Expected: 1

This is not a bug: we need the second ref to keep the WorkQueue alive in the lambda function where the main loop runs in another thread, in WorkQueue::platformInitialize:

RefPtr&lt;WorkQueue&gt; protector(this);
m_workQueueThread = createThread(threadName, [protector] {
    g_main_context_push_thread_default(protector-&gt;m_eventContext.get());
    g_main_loop_run(protector-&gt;m_eventLoop.get());
    g_main_context_pop_thread_default(protector-&gt;m_eventContext.get());
});

Since we need to keep the WorkQueue alive in another thread, I think the only option is to change the test, not the implementation. CC Brent since he wrote this test. We could guard the reference count checks with #if !PLATFORM(GTK), or just remove the checks completely.</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>