Skip to content

Commit

Permalink
Revert "feat: add Owner field to IExtensionContext (#480)" (#483)
Browse files Browse the repository at this point in the history
This reverts commit 2dcda1b.
  • Loading branch information
bdunderscore authored Nov 29, 2024
1 parent 0381958 commit b385c81
Show file tree
Hide file tree
Showing 4 changed files with 2 additions and 34 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Changed

### Removed
- [#483] Removed `IExtensionContext.Owner` due to compatibility issues.

### Security

Expand Down
16 changes: 0 additions & 16 deletions Editor/API/BuildContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -272,18 +272,10 @@ public void DeactivateExtensionContext(Type t)
{
var ctx = _activeExtensions[t];
Profiler.BeginSample("NDMF Deactivate: " + t);

using var scope = ErrorReport.WithContext(ctx);
try
{
ctx.OnDeactivate(this);
}
catch (Exception e)
{
// ensure we report the exception while the error report context is set
ErrorReport.ReportException(e);
return;
}
finally
{
Profiler.EndSample();
Expand Down Expand Up @@ -373,18 +365,10 @@ public IExtensionContext ActivateExtensionContext(Type ty)
if (!_activeExtensions.ContainsKey(ty))
{
Profiler.BeginSample("NDMF Activate: " + ty);

using var scope = ErrorReport.WithContext(ctx);
try
{
ctx.OnActivate(this);
}
catch (Exception e)
{
// ensure we report the exception while the error report context is set
ErrorReport.ReportException(e);
return null;
}
finally
{
Profiler.EndSample();
Expand Down
10 changes: 1 addition & 9 deletions Editor/API/IExtensionContext.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
#nullable enable

using System;
using System;
using System.Collections.Generic;
using System.Collections.Immutable;

Expand All @@ -22,12 +20,6 @@ public interface IExtensionContext
/// </summary>
/// <param name="context"></param>
void OnDeactivate(BuildContext context);

/// <summary>
/// Return the plugin owning this extension context. Implementing this API is optional for backwards
/// compatibility, but is encouraged as it will provide better error messaging.
/// </summary>
PluginBase? Owner => null;
}

internal static class ExtensionContextUtil
Expand Down
9 changes: 0 additions & 9 deletions Editor/ErrorReporting/ErrorReport.cs
Original file line number Diff line number Diff line change
Expand Up @@ -308,15 +308,6 @@ internal IDisposable WithContext(PluginBase thePlugin)
CurrentContext.Plugin = thePlugin;
return scope;
}

internal IDisposable WithContext(IExtensionContext theExtension)
{
var scope = new RestoreContextScope(this);

if (theExtension.Owner != null) CurrentContext.Plugin = theExtension.Owner;

return scope;
}

internal IDisposable WithContextPassName(string name)
{
Expand Down

0 comments on commit b385c81

Please sign in to comment.