Incorrect ImageItemOverride::calculateDependencies() causes image Media source fields to be deleted when uninstalling Canvas
>>> [!note] Migrated issue
<!-- Drupal.org comment -->
<!-- Migrated from issue #3575579. -->
Reported by: [cadence96](https://www.drupal.org/user/3520894)
Related to !647
>>>
<h3 id="overview">Overview</h3>
<p>
The issue leaves the Media type configuration in an inconsistent state after uninstalling Canvas.
</p>
<p>
Uninstalling the <strong>Canvas</strong> module removes fields from the <strong>Media (Image)</strong> type.<br>
After uninstalling, visiting <code>/admin/structure/media/manage/image</code> triggers a fatal error:
</p>
<pre><pre>Call to a member function getLabel() on null<br>in Drupal\media\MediaSourceBase-&gt;buildConfigurationForm()</pre></pre><p>
This breaks the Media type configuration UI.
</p>
<h3 id="steps-to-reproduce">Steps to reproduce</h3>
<ol>
<li>
Install the required modules:
<pre>drush en canvas media media_library -y</pre></li>
<li>
Go to <code>/admin/structure/media/manage/image</code> and confirm everything works correctly.
</li>
<li>
Uninstall Canvas:
<pre>drush pmu canvas -y</pre></li>
<li>
Visit again: <code>/admin/structure/media/manage/image</code>
</li>
</ol>
<h3 id="actual-result">Actual result</h3>
<ul>
<li>Fields from the <strong>Media Image</strong> type are removed.</li>
<li>
The Media type edit page throws a fatal error:
<pre>Call to a member function getLabel() on null</pre></li>
<li>The form display and view display for <code>media.image</code> are affected.</li>
</ul>
<h3 id="expected-result">Expected result</h3>
<ul>
<li>Uninstalling Canvas should <strong>not remove or alter fields</strong> from the Media Image type.</li>
<li>The Media configuration pages should remain functional.</li>
<li>No core Media configuration should be broken.</li>
</ul>
<p>
I’m attaching a video that reproduces the bug.
</p>
> Related issue: [Issue #2884120](https://www.drupal.org/node/2884120)
> Related issue: [Issue #3572879](https://www.drupal.org/node/3572879)
> Related issue: [Issue #3569262](https://www.drupal.org/node/3569262)
> Related issue: [Issue #3544604](https://www.drupal.org/node/3544604)
> Related issue: [Issue #3579536](https://www.drupal.org/node/3579536)
issue