-
-
Notifications
You must be signed in to change notification settings - Fork 6.3k
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
[Applicaion/GuiComponent] - don't call init/deinit of subcomponents of guicomponent from application #15825
Conversation
@FernetMenta did i get your intention right here? At least that is what i understood from your comments here: #13743 |
@Memphiz if you want to fix #13878 I suggest https://pastebin.com/BX5makLi |
But with this you still have application init a sub component of GUI (the window manager) + you added a circular dependency between gui and window manager. Also why did you add the GUI message header to all the GUI classes? |
One step after another. Moving msg target one level higher solves the linked issue but leaves some issues in the design. |
Right - that’s worse indeed. This would get rid of the circular dependency involving friend class and gives window manager only what it needs from GUI component. |
6c1df18
to
b2884a4
Compare
@FernetMenta updated with your changes and adapted by splitting CGUIComponent up into 2 interfaces ... one for windowmanager (containing the ProcessMsgHooks only) and one for the rest of kodi (containing all but the ProcessMsgHooks). |
@Memphiz I used the concept of a friend class to protect the msg driver method. I agree, this is ugly but it is recognisable as a quick and dirty approach. If you introduce interfaces, you should start to do it right or upcoming changes will be a mess too. Init/Deinit do not fit into the same interface as methods like GetInfoManager. |
So what’s the preferred approach - using your approach as is or removing deinit/init from the interface, make it a shared pointer in broker and leave application with the complete GUI component object? |
If this is directed to me, you ask the wrong person. I just wanted to give some insights on why my patch looks like it is. Since nobody else cared about the issue for months, I think it's your preference that counts. |
@@ -337,7 +337,7 @@ bool CEventServer::ExecuteNextAction() | |||
unsigned int actionID; | |||
CActionTranslator::TranslateString(actionEvent.actionName, actionID); | |||
CAction action(actionID, 1.0f, 0.0f, actionEvent.actionName); | |||
CGUIComponent* gui = CServiceBroker::GetGUI(); | |||
IGUIComponent* gui = CServiceBroker::GetGUI(); | |||
if (gui) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I know this is all very much WIP and there is a long way to go with refactoring things step by step, but by browsing those changes I really wondered why the EventServer needs to know anything about the GUI? Having it trigger a sound by itself is IMO terribly wrong and should be handled by g_application.OnAction(action)
consumers. I know it's something for a different patch, just wondered if this oddity will be gone in the long run.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well this oddity will go as soon as someone makes it go ;) - I have no plans for the GUI component I just wanted to fix the stereoscopic regression in a way that was accepted.
e1a2a61
to
7938666
Compare
updated. removed init/deinit from the interface and made gui a shared_ptr in application an servicebroker. |
7938666
to
46a06e6
Compare
} | ||
|
||
void CGUIComponent::Deinit() | ||
{ | ||
CServiceBroker::UnregisterGUI(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
unregister from ServiceBroker is mandatory here. Deinit puts the service out of order
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But it’s inconsistent to have it done in the object that gets registered. The owner is application - the owner is responsible to resolve the injected dependencies - like it is done with other broker registrees already.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you only unregister it at cleanup but it has to be unregistered during unload/load skin and maybe other operation too. encapsulation makes sense here.
btw: unregister needs to wait until last client has released the shared pointer. that's the reason why it is a shared pointer: https://github.com/xbmc/xbmc/blob/master/xbmc/Application.cpp#L2535
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this new behavior? Can't see where the GUI was deregistered during unload/load skin before tbh. But its a good idea to change skins only while no GUI Users are calling into the component for sure.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have added some more commits towards your directions. Though the check for the gui pointer might be not easily doable ... i started it but still have 1025 hits on unguarded accesses ... :(
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this new behavior? Can't see where the GUI was deregistered during unload/load skin before tbh
Sorry, I forgot to mention that this was my personal view on this, not an official direction of team kodi.
The scenario I had in mind was i.e. that you run headless kodi, launch an X11 desktop and Kodi Ui gets visible, close the desktop -> Kodi falls back to headless, log on to Wayland -> you get Wayland UI of Kodi, ...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As far as I am concerned nobody in team kodi has GUI ownership atm - so no need to stress that your opinion is not official or what not. Just discussing improvements here and trying to find a way to give that shared pointer a meaning ;)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
True and true.
We still want to support the scenario you mentioned @FernetMenta and appreciate your feedback a lot.
I think I speak for the team, when I say this.
…et - workaround for xbmc#13878 for leia" This reverts commit 5424c25.
…lled in via windowmanager anymore
…ion the full CGuiComponent as member
…er from gui component to application
…to own methods and prepare for being able to activate/deactivate the gui component by utilising the shared pointer reference counter
46a06e6
to
4f90199
Compare
@Memphiz this needs a rebase |
@Memphiz would you like to progress this, close it or put it on the backburner? |
Instead refactor init/deinit of guicomponent to do the righthing - fixes #15561
This might be the proper fix instead of #13878
It ensures that loadskin/unloadskin calls init/deinit of guicomponent instead of the subcomponent (windowmanager). To make it work the init/deinit of guicomponent was altered to not deregister from servicebroker during deinit - but only in the dtor.
Also the application cleanup now only calls reset on the gui because the dtor already does the deinit (would have been a double deinit before which is a nop).
With this the stereoscopic mode selection works properly again (and it turns off 3d mode after playback if setting is configured that way)