Repository navigation
Conversation
…fullscreen MainWindow::window() lazily constructs the singleton and only stores the pointer once the constructor returns. readSettings(), called from inside the constructor, restores the output window in fullscreen when the saved displayOutputWindow preference is true; showing it repaints OutputGLCanvas, whose drawForeground asks MainWindow::window(), which finds no instance yet and constructs a second MainWindow — forever. Each turn creates a new OpenGL context, so macOS floods the console with "Context leak detected, msgtracer returned -1" and the app never shows. Publish the singleton as the first thing the constructor does, so any code reached from inside construction gets this instance.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
When the
displayOutputWindowpreference was saved astrue(output window left in fullscreen on the previous run), MapMap never shows its window on the next start: it spins at ~90 % CPU and, on macOS, the console floods withContext leak detected, msgtracer returned -1.MainWindow::window()lazily constructs the singleton and only stores the pointer after the constructor returns.readSettings(), called from inside the constructor, restores the output window in fullscreen; showing it repaintsOutputGLCanvas, whosedrawForeground()callsMainWindow::window(), which finds no instance yet and constructs a secondMainWindow— recursively, forever. Each turn creates a new OpenGL context, hence the leak messages.A
sampleof the hung process shows the loop (MainWindow::MainWindow()nested >1000 times):Fix
Publish the singleton as the first thing the constructor does (
_instance = this), so any code reached from inside construction gets this instance instead of building another one. The code is shared, so the same hang can happen on Windows and Linux.How to reproduce / verify
macOS:
defaults write com.artpluscode.MapMap displayOutputWindow -bool true, then launch — before this patch the app never appears; with it, it starts with the output window in fullscreen as expected. Tested ondev(cc29e94) with Qt 6.8.3 and 6.11.2 on Apple Silicon (macOS 15.5 and 26).