Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

ARToolKitNFTCore: calling setupAR2() again leaves markers undetected and leaks the AR2 handle

Open
#87 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
25/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Active
Tech stack
cpp
Domain
ar-vr-xr

Research direction

Start in ARToolKitNFTCore.cpp at setupAR2(), where the old ar2Handle is overwritten without being freed, and in addNFTMarkers(), which re-applies refDataSetAll. Read ARToolKitNFTCore.h for the documented limitations. Done means a second setupAR2() frees the old handle without leaking, and maintainers have chosen between re-arming detection inside setupAR2() and a separate rearmDetection(). The issue also asks for a re-initialisation scenario in tools/compare-builds.js, which needs maintainer input first.

Written by the indexing model from the issue text.

Description

C/C++ code enhancement

Summary

Follow-up to the ARToolKitNFTCore extraction (webarkit/jsartoolkitNFT#683; the core lands in WebARKitLib with the feat/nft-core PR). Two limitations of re-calling setupAR2(), both kept from the original bindings so the refactor stays behaviour-identical, now documented in ARToolKitNFTCore.h:

  1. No detection until the next addNFTMarkers(). setupAR2() recreates the KPM handle (and drops the detector), so the KPM matcher no longer holds the markers already loaded: they are tracked if already locked, but never re-detected. Calling addNFTMarkers({}) re-arms detection (it re-applies the accumulated reference data set), but it returns {}, the same value as a failure.
  2. AR2 handle leak. A second setupAR2() without a setCamera() in between overwrites ar2Handle without deleting it (ARToolKitNFTCore.cpp, setupAR2); with the threaded AR2 variant the old handle's worker threads leak too. The original bindings did the same.

Proposal

  • In setupAR2(), delete an existing AR2 handle before creating the new one (a no-op on the normal flow, where setCamera() already freed it).
  • After recreating the KPM handle, re-apply the accumulated reference data set (refDataSetAll) and recreate the detector, so loaded markers stay detectable; or add an explicit rearmDetection() with a distinct return value.

Both change observable behaviour of the jsartoolkitNFT bindings on a re-initialisation path, so they belong in a release note, and the jsartoolkitNFT comparison tool (tools/compare-builds.js) should be extended with a re-initialisation scenario first.

Dominant language
C++
Stars
21
Forks
8
Avg merge
7h 30m
Merged PRs (30d)
25

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from webarkit/WebARKitLib

All issues in webarkit/WebARKitLib

Similar issues

More C++ issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.