Avoid a C++ runtime error thrown by jpackage launchers
Launchers created by jpackage may throw a C++ runtime error related to pure virtual method invocation - "pure virtual method called". Strangely this happens only with the release and fastdebug configurations AND if libstdc++ is not statically linked (as with the Debian source package build). The "pure virtual method called" error comes from a "destructor" function which is expected to be invoked during library unload. The function invokes a logging call which ends up invoking some virtual methods. Plain analysis of the code does not indicate a pure virtual method being invoked. Also, why this doesn't happen with slowdebug or with statically linked libstdc++ is a matter of investigation.
Build and test
$ git clone git@salsa.debian.org:pushkarnk/openjdk.git
$ git checkout -b upstream
$ cd .. && pull-debian-source openjdk-22
$ gbp import-orig ../openjdk-22_22~5ea.orig.tar.xz --debian-branch=c++-runtime-error
$ git checkout c++-runtime-error
$ sudo debuild -b -d -uc -us
...
...
       
Ran tests using debian/tests/jdk:
...
Passed: tools/jpackage/share/jdk/jpackage/tests/ModulePathTest2.java
Passed: tools/jpackage/share/jdk/jpackage/tests/MultipleJarAppTest.java
Passed: tools/jpackage/share/AppLauncherEnvTest.java <<<<<<<<<<<<<<<<<<<<< Test ran and passed.
Passed: tools/jpackage/share/jdk/jpackage/tests/AppVersionTest.java
Passed: tools/jpackage/share/jdk/jpackage/tests/JLinkOptionsTest.java
...
Edited  by Pushkar Kulkarni