MerginMaps / MerginMaps/mobile

Crash when browsing map due to unhandled exception

Open
#3,905 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
C++
Stars
388
Forks
87
Avg merge
2d 7h
Merged PRs (30d)
20

Description

I was able to get the mobile app to crash (using desktop build) - loaded a project with a local CRS and then zooming out a lot. This triggered coordinate transform exception: QgsDistanceArea::measureLine() can throw an exception, but InputUtils::screenUnitsToMeters() does not catch it.

(It may be good to do a small audit of the code to see if all QGIS API calls that are marked that thay may throw an exception are handled properly.)

I have a test project I can share (martin/test-cog-webp).

#0  __pthread_kill_implementation (no_tid=0, signo=6, threadid=<optimized out>) at ./nptl/pthread_kill.c:44
#1  __pthread_kill_internal (signo=6, threadid=<optimized out>) at ./nptl/pthread_kill.c:78
#2  __GI___pthread_kill (threadid=<optimized out>, signo=signo@entry=6) at ./nptl/pthread_kill.c:89
#3  0x00007ffff424527e in __GI_raise (sig=sig@entry=6) at ../sysdeps/posix/raise.c:26
#4  0x00007ffff42288ff in __GI_abort () at ./stdlib/abort.c:79
#5  0x00007ffff46a5ff5 in ??? () at /lib/x86_64-linux-gnu/libstdc++.so.6
#6  0x00007ffff46bb0da in ??? () at /lib/x86_64-linux-gnu/libstdc++.so.6
#7  0x00007ffff46a5a55 in std::terminate() () at /lib/x86_64-linux-gnu/libstdc++.so.6
#8  0x00007ffff46a5a6f in ??? () at /lib/x86_64-linux-gnu/libstdc++.so.6
#9  0x0000555555bfe320 in QgsCoordinateTransform::transform(QgsPointXY const&, Qgis::TransformDirection) const [clone .cold] ()
#10 0x0000555556bb8bc3 in QgsDistanceArea::measureLine(QgsPointXY const&, QgsPointXY const&) const ()
#11 0x000055555615ec48 in InputUtils::screenUnitsToMeters(InputMapSettings*, int) ()
#12 0x00005555561e138a in ScaleBarKit::updateScaleBar() ()

Contributor guide

Open the contributing guide

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.

Research direction

Start at InputUtils::screenUnitsToMeters(), called by ScaleBarKit::updateScaleBar(), and reproduce the crash by opening the project with a local CRS and zooming out. Inspect the coordinate transform path and the listed QGIS API call; done means the map no longer terminates when that transform exception occurs. The issue also suggests auditing other marked-throwing API calls.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
mobile-dev
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.