Skip to content
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

kill global g_windowManager #13722

Merged
merged 2 commits into from
Apr 1, 2018
Merged

kill global g_windowManager #13722

merged 2 commits into from
Apr 1, 2018

Conversation

FernetMenta
Copy link
Contributor

  • kills g_windowManager
  • created gui components that owns gui objects
  • CWindowManager is embedded into CGUIComponent
  • StereoscopicManager follows

clients of GUI should check the interface pointer they get from ServiceBroker. GUI won't be mandatory in future version.

CGUIWindowManager& GetWindowManager();

protected:
std::unique_ptr<CGUIWindowManager> m_pWindowManager;

This comment was marked as spam.

@garbear
Copy link
Member

garbear commented Mar 31, 2018

I didn't know you'd come to the rescue with a thousand lines of code ;) I'll review this weekend and relocate StereoscopicsManager.

Copy link
Member

@garbear garbear left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PR looks good. I'll port CStereoscopicsManager in the next day or two

@@ -53,7 +54,7 @@ bool CFileUtils::DeleteItem(const CFileItemPtr &item, bool force)
if (!item || item->IsParentFolder())
return false;

CGUIDialogYesNo* pDialog = g_windowManager.GetWindow<CGUIDialogYesNo>(WINDOW_DIALOG_YES_NO);
CGUIDialogYesNo* pDialog = CServiceBroker::GetGUI()->GetWindowManager().GetWindow<CGUIDialogYesNo>(WINDOW_DIALOG_YES_NO);

This comment was marked as spam.

This comment was marked as spam.

This comment was marked as spam.

@FernetMenta
Copy link
Contributor Author

@da-anda 014e8a4 shows the tedious tasks we have to do. No fance framework or technology solves those issues. GUI logic has to be removed from lower layers.

@garbear more bullet points for your how-to:

  • never ever use default parameters in functions/methods. In our case here test suite was not aware that it requested confirmation dialog for DeleteItem
  • components like generic utils, network, input, etc, must not depend on GUI.

@@ -78,7 +78,11 @@ namespace XBMCAddon
bool rmdir(const String& path, bool force)
{
DelayedCallGuard dg;
return (force ? CFileUtils::DeleteItem(path,force) : XFILE::CDirectory::Remove(path));

This comment was marked as spam.

@Voyager1
Copy link

Voyager1 commented Apr 2, 2018

this segfaults on Windows. There are calls to GetWindowManager() from the WM_PAINT event before the CGUIComponent pointer is even initialized.

@@ -721,7 +722,7 @@ bool CApplication::CreateGUI()
info.iHeight,
info.strMode.c_str());

g_windowManager.Initialize();
m_pGUI.reset(new CGUIComponent());

This comment was marked as spam.

This comment was marked as spam.

This comment was marked as spam.

This comment was marked as spam.

This comment was marked as spam.

@DaveTBlake
Copy link
Member

Would it not be better in future to create test builds for all platforms and do some testing (or ask others to test for you) before merging such large changes?

Because of this PR I just spent several hours on a messy rebase of my work, that has been ready for merge for weeks but waiting for review, only to find it seg faults. Very unimpressed.

afedchin added a commit to afedchin/xbmc that referenced this pull request Apr 3, 2018
afedchin added a commit that referenced this pull request Apr 3, 2018
[win32] fix crash after #13722 + cosmetics
@Rechi Rechi added Type: Cleanup non-breaking change which removes non-working or unmaintained functionality v18 Leia labels Apr 3, 2018
@Rechi Rechi added this to the Leia 18.0-alpha2 milestone Apr 3, 2018
@garbear
Copy link
Member

garbear commented Apr 3, 2018

@DaveTBlake killing globals is a thankless task. It takes hours and it's almost guaranteed something will break every time. Nevertheless, it's important that we fight these architectural road blocks. More globals-killing is needed, so keep a lookout for these PRs. Thanks for the understanding.

@peak3d
Copy link
Contributor

peak3d commented Apr 3, 2018

@garbear yep, I believe that it is an thankless task, and therefore we should produce something for testing. Don't matter if internal or external. I suggest to trigger a test build and ask kodi members to test it on different platforms. If the test version is public available, I could also ask the userbase or we make a thread in forum.kodi.tv for such critical test builds.

@FernetMenta
Copy link
Contributor Author

Well, sorry for the inconvenience but I don't think the trouble was that hard as it seems when reading those complaints. Sorry for the breakage of Windows and PI build and many thanks to @Voyager1 @afedchin @popcornmix for helping out fixing the issues quickly.
Apart from a crash at exit, fix is already provided, current master is fine. Do you really consider this as a major case to worry about? Why not feeling happy that the application has been improved?

@DaveTBlake
Copy link
Member

Why not feeling happy that the application has been improved?

Happy for that @FernetMenta, well done have a cookie etc.

Unhappy to have wasted 8 hours of my life, which could have been avoided with a better communication. Unhappy that your response to that is "I don't think the trouble was that hard". Well that is just your opinion.

Equally that waste could have been avoided with some very basic platform testing before this extensive PR was merged. Of course testing does not catch everything, but we could at least try. I understand the need for speed to avoid yet more rework, but making test builds available on the mirrors is so easy, and members would use them to test something promptly if asked.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Cleanup non-breaking change which removes non-working or unmaintained functionality v18 Leia
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants