-
Notifications
You must be signed in to change notification settings - Fork 345
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
MythContext refactoring #671
Draft
ulmus-scott
wants to merge
29
commits into
MythTV:master
Choose a base branch
from
ulmus-scott:mythcontext
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Conversation
This file contains 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
ulmus-scott
force-pushed
the
mythcontext
branch
from
November 29, 2022 22:43
c8c801d
to
da41b45
Compare
ulmus-scott
force-pushed
the
mythcontext
branch
from
November 17, 2024 08:27
da41b45
to
7b78dfa
Compare
These details do not need to be exposed in the header since MythContextPrivate is already a QObject.
Convert it to a nested private class and rename MythContext::d to m_impl.
It was only used once by a line from commit 0d4ef8e Use MythContext::Impl's own members and methods instead of redirecting back to them through MythContext.
Whether to show the prompt was never determined at runtime and in one case was forced regardless of whether or not a temporary window already existed (which would have prevented the prompt from showing as it would return early from TempMainWindow()).
and directly access the MythDB singleton. This should help reasoning about further changes.
…calls The only functional difference is that m_dbParams::m_localEnabled is now conditionally set before the first `gCoreContext->GetDB()->SetDatabaseParams(m_dbParams);` call. This doesn't matter since it was set before the second SetDatabaseParams() call, likely via ResetDatabase(). Also, DatabaseParams::m_localEnabled is practically unused. This split is to enable refactoring out the DatabaseSettingsCache into its own class by reducing LoadDatabaseSettings() to its core functionality. This is necessary to enable loading the cache in its constructor before the MythCoreContext constructor has finished, i.e. while gCoreContext is nullptr.
…ingleton This should allow moving the DatabaseSettingsCache to MythDB since save can now be called at any time.
These are only used in mythtv/programs and occasionally in mythtv/libs, so this can be a private header.
The current QT5_MIN_VERSION_STR is 5.15.2.
and move its use in *.h to *.cpp files. git grep -l mythcorecontext.h > mythcorecontext.txt; git grep -l -E "gCoreContext|MythCoreContext" -- ':!*/i18n/*' > gCoreContext.txt; git diff --no-index -U0 mythcorecontext.txt gCoreContext.txt git grep -l mythcorecontext.h -- *.h A few remain in programs.
It was never set nor reset and would thus not work as intended.
It was only used twice and I will replace one of those uses shortly.
This is to simplify moving the cache to MythDB. DatabaseParamsCache::SaveDatabaseParams(): inline ResetDatabase(), removing the duplicate call to MythDB::SetDatabaseParams().
If the string is already empty then clearing it does nothing and the DatabaseParams are already equal.
GetMythDB() will always return a valid pointer to the global MythDB instance. Some of the functions previously did not update the DatabaseParams in MythDB; however, this shouldn't make a difference since only libmyth/mythcontext.cpp ever called MythDB::SetDatabaseParams(). gContext is now unused in the libraries and can be removed.
After much investigation, I discovered that the popup the hack is supposed to be preventing has not existed since it was replaced with a notification in 2013 in 7dcf2a5
Convert it into an instance so the destructor is called automatically. mythtv-setup: SetupMenuCallback() does not use the data pointer, so feed it with nullptr. mythfrontend: TVMenuCallback() also does not use the data pointer, so feed it with nullptr. mythbackend: httpconfig.cpp: The only HttpConfig is created in MediaServer::Init() which is only called in run_backend() after the MythContext is created in main(), so that check was always false. V2Myth::s_WebOnlyStartup: I would have prefered to avoid global state and pass it as a parameter to V2Myth() via run_backend() and run_setup_webserver() but the entire class is already static. V2Myth is a better place for WebOnlyStartup since that is the only place it is used. CleanupGuards: Move the CleanupGuard instance after the MythContext, so it is destroyed first. ~MythCoreContextPrivate() calls MThread::Cleanup() which wants all threads to already be destroyed. Move DestroyMythMainWindow() into ~MythContext() so the static MythUDP instance destroys its thread. ReferenceCounter::PrintDebug(): remove extraneous ui include and move into ~MythContext() so it is called after all objects should be destroyed.
I would have preferred to make it into an instance within MythContext, but libmythtv/tv_play.cpp uses SignalHandler::IsExiting(), which seems like a hack. From: MythTV@f9a46e0 If _WIN32 is defined, the SignalHandler will only create its initial strings. mythfrontend's extra signal handlers are triggered externally and are from: MythTV@4b67e3e MythTV@2aa4aa5
ulmus-scott
force-pushed
the
mythcontext
branch
from
December 2, 2024 00:56
7b78dfa
to
a57d74a
Compare
…mythlogging.h"' git grep -l mythlogging.h > mythlogging.txt; git grep -l -w -E "LOG|VERBOSE_" -- mythplugins mythtv/libs mythtv/programs > LOG.txt; git diff --no-index -U0 mythlogging.txt LOG.txt git grep -l mythlogging.h -- *.h Only header in mythplugins is a header only file.
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.
I had planned to do more, but I got fed up with the use of global state and Singletons, so this is all I have done for now.
Checklist