-
Notifications
You must be signed in to change notification settings - Fork 1
fix: Base64QRCode chama base SetQRCodeData e dispoem o renderizador interno #90
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -89,9 +89,25 @@ public Base64QRCode(QRCodeData data) : base(data) | |
| /// <param name="data">The data.</param> | ||
| public override void SetQRCodeData(QRCodeData data) | ||
| { | ||
| base.SetQRCodeData(data); | ||
| this.qr.SetQRCodeData(data); | ||
| } | ||
|
|
||
| /// <summary> | ||
| /// Releases the unmanaged resources and optionally releases the managed resources. | ||
| /// </summary> | ||
| /// <param name="disposing">true to release both managed and unmanaged resources; false to release only unmanaged resources.</param> | ||
| protected override void Dispose(bool disposing) | ||
| { | ||
| if (disposing) | ||
| { | ||
| this.qr?.Dispose(); | ||
| this.QrCodeData = null; | ||
| } | ||
|
|
||
| base.Dispose(disposing); | ||
| } | ||
|
Comment on lines
+100
to
+109
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🟡 Shared QR code data is disposed twice during cleanup, once by the inner renderer and again by the base class The shared data object is disposed by the inner renderer ( Impact: Currently benign because the data's dispose only nulls fields, but will cause errors if that disposal ever performs non-idempotent cleanup. Double-dispose mechanism through shared QRCodeData referenceWhen Similarly, when During
Fix: Either don't call Prompt for agentsWas this helpful? React with 👍 or 👎 to provide feedback.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Corrigido. O
Comment on lines
+100
to
+109
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 📝 Info: The Dispose override fixes a resource leak where the inner QRCode was never cleaned up Before this PR, Was this helpful? React with 👍 or 👎 to provide feedback. |
||
|
|
||
| /// <summary> | ||
| /// Returns the graphic representation of the QR code. | ||
| /// </summary> | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
📝 Info: The SetQRCodeData fix corrects a pre-existing bug where base class data was never set
Before this PR,
SetQRCodeDatainBase64QRCodeonly calledthis.qr.SetQRCodeData(data)without callingbase.SetQRCodeData(data). This meant thatthis.QrCodeData(the inherited property fromAbstractQRCode) remained null when using the parameterless constructor +SetQRCodeDataflow. While this didn't cause runtime issues becauseBase64QRCodedelegates all rendering to the innerqrfield (which did have the data), it violated the contract ofAbstractQRCodeand could confuse any code that inspectsQrCodeDataon the base class. The addition ofbase.SetQRCodeData(data)atQRCoder.Core/Renderers/Base64QRCode.cs:92is a correct fix.Was this helpful? React with 👍 or 👎 to provide feedback.