Closed thommie-echo closed 2 years ago
Is it only for AttachId
that it crashes, or also for other properties?
I haven't tried everything yet, I'll update this as I go. Properties not affected:
Properties affected:
That potentially narrows it down a bit. Does LocalPage
points to a valid CGameManialinkPage
object?
No, it appears to be the first iteration of Render() where LocalPage
is null that the crash occurs
Additionally, after following the three steps outlined in the issue, if you try to access App.Network.ClientManiaAppPlayground.ClientUI.UILayers
in the Nod explorer the game also crashes.
Based on your question I figured out the following workaround in the attached file.
Whenever the layer still exists in ClientUI.UILayers
but the LocalPage
is null then the game crashes. So when you check for when LocalPage
is null and then you add the layer you need again it still works.
The problem with this is that the faulty layer still exists within ClientUI.UILayers
. So if you try to see what layers exist in the Nod explorer the game still crashes.
Could it be a refcounting issue? I don't really have the means to check right now, but there's a chance that the layers created by UILayerCreate are (supposed to be) refcounted.
You can check this in Nod Explorer, you can see the text "Refs: N" in nods. If the game's own layers are not 0, but yours is, then you might have to increase the refcount yourself, using layer.MwAddRef()
. (You probably don't have to worry about releasing it manually, but that will have to be seen..)
Using layer.MwAddRef()
does indeed solve the crash, however sometimes the Nod Explorer will show that the ClientUI has 0 UILayers yet the plugin still has a reference to a valid layer. Could this mean that I'd have to release it if this is the case, create a new layer and then call MwAddRef()
again?
Additionally I figured out the following:
Both ClientManiaAppPlayground
and ClientManiaAppPlayground.ClientUI
have UILayers
.
If you use ClientManiaAppPlayground.UILayerCreate()
the layer is already added to the ClientManiaAppPlayground.UILayers
If you then add the layer to either the ClientManiaAppPlayground.UILayers
or the ClientManiaAppPlayground.ClientUI.UILayers
without MwAddRef()
the game will crash similarly to before.
For now I've decided to just rely on ClientManiaAppPlayground.UILayerCreate()
and not manually adding to the UILayers
to avoid having to deal with MwAddRef()
but mainly to avoid the game crashing.
Thanks for the help, feel free to close this if you feel this is sufficient!
Thanks for the added info, this indeed doesn't seem as much like it is an Openplanet bug, then, but more a mis-use of Nadeo's API. Will close this 👍
The crash occurs when trying to access the AttachId of a CGameUILayer after a map and gamemode change on a dedicated server. This was only tested on a dedicated server run locally.
Steps:
It will still print "Getting layer at index: " + i) but as soon as you try to access the AttachId after the gamemode and map have changed the game crashes.
For reference and testing see line 72 in the below file: Plugin_UIError.txt