Skip to content

Commit

Permalink
[4.1] Do not double lock assets (joomla#36776)
Browse files Browse the repository at this point in the history
* Do not double lock assets

* db update

* Remove double asset lock (#19)

* Remove double asset lock

* Only remove lock

Co-authored-by: Benjamin Trenkle <[email protected]>
  • Loading branch information
laoneo and bembelimen authored Jan 22, 2022
1 parent 3bd24fc commit 6185157
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 26 deletions.
16 changes: 8 additions & 8 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

25 changes: 7 additions & 18 deletions libraries/src/Table/Nested.php
Original file line number Diff line number Diff line change
Expand Up @@ -547,13 +547,6 @@ public function delete($pk = null, $children = true)
);
$this->getDispatcher()->dispatch('onBeforeDelete', $event);

// Lock the table for writing.
if (!$this->_lock())
{
// Error message set in lock method.
return false;
}

// If tracking assets, remove the asset first.
if ($this->_trackAssets)
{
Expand All @@ -562,35 +555,31 @@ public function delete($pk = null, $children = true)
/** @var Asset $asset */
$asset = Table::getInstance('Asset', 'JTable', array('dbo' => $this->getDbo()));

// Lock the table for writing.
if (!$asset->_lock())
{
// Error message set in lock method.
return false;
}

if ($asset->loadByName($name))
{
// Delete the node in assets table.
if (!$asset->delete(null, $children))
{
$this->setError($asset->getError());
$asset->_unlock();

return false;
}

$asset->_unlock();
}
else
{
$this->setError($asset->getError());
$asset->_unlock();

return false;
}
}

// Lock the table for writing.
if (!$this->_lock())
{
// Error message set in lock method.
return false;
}

// Get the node by id.
$node = $this->_getNode($pk);

Expand Down

0 comments on commit 6185157

Please sign in to comment.