Thread Tools Display Modes
05-21-16, 04:22 PM   #1
Gello
A Molten Giant
AddOn Author - Click to view addons
Join Date: Jan 2005
Posts: 521
Client crash bug with HybridScrollFrames

Reposting from official forum:

It seems parenting a frame that contains a HybridScrollFrame to the PetJournal and back to UIParent causes all sorts of weirdness: scrollchild boundries not working, textures not writing, ARTWORK-layer fontstrings going behind BACKGROUND-layer textures on mouseover, HIGHLIGHT-layer textures not following the mouse, and then a client crash.

To reproduce, create the three files named in bold in a folder under AddOns called HybridTest:

HybridTest.toc
Code:
## Interface: 70000
## Title: HybridTest
## Notes: Testing for weird behavior and client crashes with HybridScrollFrames
HybridTest.xml
HybridTest.lua
HybridTest.xml
Code:
<Ui>

  <!-- template for HybridScrollFrame buttons -->
  <Button name="HybridTestButtonTemplate" virtual="true">
    <Size x="200" y="44"/>
    <Layers>
      <!-- background layer: a black listbutton texture -->
      <Layer level="BACKGROUND">
        <Texture file="Interface\Buttons\ListButtons">
          <TexCoords left="0" right="0.82421875" top="0.00390625" bottom="0.18359375"/>
        </Texture>
      </Layer>
      <!-- artwork layer: a single fontstring (Name) to write data -->
      <Layer level="ARTWORK">
        <FontString parentKey="Name" inherits="GameFontHighlight" justifyH="LEFT">
          <Size x="190" y="20"/>
          <Anchors>
            <Anchor point="LEFT" x="5" y="0"/>
          </Anchors>
        </FontString>
      </Layer>
      <!-- highlight layer: a listbutton highlight to further show weird effects -->
      <Layer level="HIGHLIGHT">
        <Texture file="Interface\Buttons\ListButtons">
          <TexCoords left="0" right="0.82421875" top="0.19140625" bottom="0.37109375"/>
        </Texture>
      </Layer>
    </Layers>
    <Frames>
      <!-- this button is anchored *outside* the above button and will reliably cause a client crash -->
      <Button parentKey="Button" inherits="ItemButtonTemplate">
        <Size x="36" y="36"/>
        <Anchors>
          <Anchor point="RIGHT" relativePoint="LEFT" x="-2" y="0"/>
        </Anchors>
      </Button>
    </Frames>
  </Button>

  <!-- frame has a tooltip-like backdrop and contains a basic HybridScrollFrame -->
  <Frame name="HybridTestFrame" parent="UIParent">
    <Size x="274" y="400"/>
    <Anchors>
      <Anchor point="CENTER"/>
    </Anchors>
    <Backdrop bgFile="Interface\Tooltips\UI-Tooltip-Background" edgeFile="Interface\Tooltips\UI-Tooltip-Border" tile="true">
      <EdgeSize val="16"/>
      <TileSize val="16"/>
      <BackgroundInsets left="3" right="3" top="3" bottom="3"/>
      <Color r="0" g="0" b="0"/>
    </Backdrop>
    <Frames>
      <ScrollFrame parentKey="ScrollFrame" name="HybridTestScrollFrame" inherits="HybridScrollFrameTemplate">
        <Size x="264" y="390"/>
        <Anchors>
          <Anchor point="TOPLEFT" x="5" y="-5"/>
        </Anchors>
        <Frames>
          <Slider parentKey="ScrollBar" name="HybridTestScrollBar" inherits="HybridScrollBarTrimTemplate">
            <Anchors>
              <Anchor point="TOPRIGHT" x="0" y="-16"/>
              <Anchor point="BOTTOMRIGHT" x="0" y="16"/>
            </Anchors>
          </Slider>
        </Frames>
      </ScrollFrame>
    </Frames>
    <Scripts>
      <OnLoad>
        self:RegisterEvent("PLAYER_LOGIN")
        self:RegisterEvent("ADDON_LOADED")
      </OnLoad>
      <OnEvent>
        self:OnEvent(event,...)
      </OnEvent>
    </Scripts>
  </Frame>

</Ui>
HybridTest.lua
Code:
--[[

  To reproduce:
  - Log in with this addon running. You should see a list with icons in the middle of the screen.
  - Open the Pet Journal. This causes the frame to parent to the PetJournal.
  - Close the Pet Journal. This returns the frame to UIParent.

  Issues:
  - The buttons in the scrollframe don't respect the scrollchild when it's back on UIParent. Buttons show off the bottom of the scrollframe.
  - Mouseover of the frame (despite no mouseover events other than the highlight) will cause the ARTWORK-layer fontstrings to drop behind the BACKGROUND-layer texture. These fontstrings will obey the scrollchild boundries while this is happening.
  - The highlight won't reliably follow the mouse.
  - The icon textures aren't updating reliably with the text.

  To crash the client:
  - Scroll up and down. Within a few seconds of doing this the client will crash. It's taken between 1 and 15 seconds of scrolling to crash.

]]

local frame = HybridTestFrame

-- create fake data
frame.data = {}
local icons = GetMacroIcons()
for i=1,25 do
  tinsert(frame.data,{"Test Data #"..i,icons[random(#icons)]})
end
icons = nil -- no longer need these

-- event handler
function frame:OnEvent(event,...)
  if event=="PLAYER_LOGIN" then
    -- setup scrollframe
    local scrollFrame = self.ScrollFrame
    scrollFrame.update = self.UpdateList
    HybridScrollFrame_CreateButtons(scrollFrame,"HybridTestButtonTemplate",40,0)
    frame:UpdateList()
  elseif event=="ADDON_LOADED" and select(1,...)=="Blizzard_Collections" then
    -- when journal shows: move frame to journal
    PetJournal:HookScript("OnShow",function(self)
      frame:SetParent(PetJournal)
      frame:SetFrameLevel(PetJournal:GetFrameLevel()+10) -- optional; just to make frame not blend with rest
      frame:SetPoint("CENTER")
    end)
    -- when journal hides: move frame back to UIParent
    PetJournal:HookScript("OnHide",function(self)
      frame:SetParent(UIParent)
      frame:SetPoint("CENTER")
    end)
  end
end

-- update function for the scrollframe
function frame:UpdateList()
  local numData = #frame.data
  local scrollFrame = frame.ScrollFrame
  local offset = HybridScrollFrame_GetOffset(scrollFrame)
  local buttons = scrollFrame.buttons
  for i=1,#buttons do
    local index = i + offset
    local button = buttons[i]
    if index<=numData then
      button.Name:SetText(frame.data[index][1])
      button.Button.icon:SetTexture(frame.data[index][2])
      button:Show()
    else
      button:Hide()
    end
  end
  HybridScrollFrame_Update(scrollFrame, scrollFrame.buttonHeight*numData, scrollFrame.buttonHeight)
end
As it says in the comments:

To reproduce:
- Log in with this addon running. You should see a list with icons in the middle of the screen.
- Open the Pet Journal. This causes the frame to parent to the PetJournal.
- Close the Pet Journal. This returns the frame to UIParent.

Issues:
- The buttons in the scrollframe don't respect the scrollchild when it's back on UIParent. Buttons show off the bottom of the scrollframe.
- Mouseover of the frame (despite no mouseover events other than the highlight) will cause the ARTWORK-layer fontstrings to drop behind the BACKGROUND-layer texture. These fontstrings will obey the scrollchild boundries while this is happening.
- The highlight won't reliably follow the mouse.
- The icon textures aren't updating reliably with the text.

To crash the client:
- Scroll up and down. Within a few seconds of doing this the client will crash. It's taken between 1 and 15 seconds of scrolling to crash.
 
 

WoWInterface » Site Forums » Archived Beta Forums » Legion Beta archived threads » Client crash bug with HybridScrollFrames

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off