Skip to content

[OO/CSL] Instantaneous citation insertion and refresh #12849

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

Merged
merged 2 commits into from
Mar 29, 2025
Merged

Conversation

subhramit
Copy link
Member

@subhramit subhramit commented Mar 29, 2025

Reverted and superseded by #12851

Mandatory checks

  • I own the copyright of the code submitted and I license it under the MIT license
  • Change in CHANGELOG.md described in a way that is understandable for the average user (if change is visible to the user)
  • [/] Tests created for changes (if applicable)
  • Manually tested changed features in running JabRef (always required)
  • Screenshots added in PR description (if change is visible to the user)
  • Checked developer's documentation: Is the information available and up to date? If not, I outlined it in this pull request.
  • Checked documentation: Is the information available and up to date? If not, I created an issue at https://github.com/JabRef/user-documentation/issues or, even better, I submitted a pull request to the documentation repository.

Signed-off-by: subhramit <subhramit.bb@live.in>
Signed-off-by: subhramit <subhramit.bb@live.in>
@@ -598,6 +598,10 @@ public void guiActionInsertEntry(List<BibEntry> entries,
if (style instanceof CitationStyle citationStyle) {
// Handle insertion of CSL Style citations

// Lock document controllers - disable refresh during the process (avoids document flicker during writing)
// MUST always be paired with an unlockControllers() call
doc.lockControllers();
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The lockControllers() and unlockControllers() calls should be wrapped in a try-finally block to ensure that unlockControllers() is always called, even if an exception occurs.

@@ -609,6 +613,9 @@ public void guiActionInsertEntry(List<BibEntry> entries,
cslCitationOOAdapter.insertEmptyCitation(cursor.get(), citationStyle, entries);
}

// Release controller lock
doc.unlockControllers();
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The unlockControllers() call should be in a finally block to ensure it is executed even if an exception is thrown, maintaining the document's state integrity.

Copy link

trag-bot bot commented Mar 29, 2025

@trag-bot didn't find any issues in the code! ✅✨

@subhramit subhramit merged commit ab91139 into main Mar 29, 2025
2 checks passed
@subhramit subhramit deleted the csl-refresh branch March 29, 2025 19:16
Copy link
Contributor

The build for this PR is no longer available. Please visit https://builds.jabref.org/main/ for the latest build.

@subhramit subhramit mentioned this pull request Mar 29, 2025
1 task
@subhramit subhramit restored the csl-refresh branch March 29, 2025 19:25
subhramit added a commit that referenced this pull request Mar 29, 2025
krishnagjsForGit pushed a commit to krishnagjsForGit/jabref that referenced this pull request May 2, 2025
krishnagjsForGit pushed a commit to krishnagjsForGit/jabref that referenced this pull request May 2, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant