Hi Rick,Sorry I didn't follow-up earlier. I did email you a simple test form last week, but then got tied up with a client. I just created a new form with a single control.
<head>
<title></title>
</head>
<body style="margin-top: 0px; margin-left: 0px; text-align: left;">
<form id="form1" runat="server">
<div>
<fieldset>
<legend>Radio Button</legend>
<div>
<ww:wwWebRadioButtonList ID="wwWebRadioButtonList1" runat="server">
<asp:ListItem>test</asp:ListItem>
</ww:wwWebRadioButtonList>
</div>
</fieldset>
</div>
</form>
</body>
</html>
I touch the file and start VFP. Refresh the form and all works as expected. A second touch to the file with refresh causes the outstanding references error. Those are the exact steps required to duplicate this every time.
I attempted to step through the Destroy() method (and did so several dozen times) but could not figure out what is happening.
When this fails, ClearItems() is not called as THIS.Items.Count = 0 in dispose.
FUNCTION Dispose()
IF THIS.lDISPOSECALLED
RETURN
ENDIF
IF !ISNULL(THIS.ITEMS) AND THIS.Items.Count > 0
THIS.ClearItems()
THIS.Items = null
ENDIF
THIS.Items is still an object at that point. aitems() has two elements, both set to false. I copied the 'THIS.Items = null' after the loop to see if that cleared the references hanging the system, but no joy.
If you are unable to duplicate this, I'll move all this up to my server and give you access to that. Or, I guess you could connect to my desktop development machine if you prefer.
~bob
It's possible you have other unreleased controls in that page then. Pretty sure this fix will take care of the list item issue. You should check this with a simple page that just contains a list of some sort. It works for me and didn't prior to the change.
To find hung references:
* Set a breakpoint in WebControl.Destroy
* Run your app
* Hit page you think has hung refs
* Clear All/Close All
When you hit the Clear All/Close FoxPRo will trigger on any lingering controls that weren't released properly. Check the ID to or Class to figure out which ones.
+++ Rick ---
So I always drop by this site once or twice a week just to see what's up. For some reason, I did not do so last week. So I missed seeing this thread. So when my tech complained about not being able to recompile one of my pages, I was not aware of the radio button issue. So I just spent a good 3 hours trying to figure out what I had introduced into the page to cause the problem before concluding that the radio button was the problem. Then I decide to finally check out the board and find this.
Unfortunately the fix did not work for me either. Here's my WCSX code:
<div id="mainBody" style="display:none">
<form id="form1" runat="server">
<ww:wwWebErrorDisplay runat="server" id="ErrorDisplay" />
<b>Base Path:</b>
<WW:WWWEBRADIOBUTTONLIST ID="lstBase" runat='server'>
<asp:ListItem Selected="True" Value="WConnect">WConnect Folder</asp:ListItem>
<asp:ListItem Value="Manager">Manager Folder</asp:ListItem>
<asp:ListItem Value="AW">ACEweb Folder</asp:ListItem>
</WW:WWWEBRADIOBUTTONLIST>
<br />
<b>Additional Path and File Mask:</b> <br />
<ww:wwWebTextBox ID="txtPath" runat="server" Visible="True"
Width="380px" AutoPostBack="True" Change="txtPath_change" /><br /><br />
<b>Main template folder:</b> <ww:wwWebTextBox ID="txtTemplateFolder" runat="server" Visible="True"
Width="39px" AutoPostBack="True" Change="txtFolder_change" Text="ace" /> <font size="-2">(Leave as "ace" unless using an Alternate Interface)</font><br />
<ww:wwWebButton ID="btnGo" runat='server' Width='80' Text="Go"
Click="btnGo_Click" OnClientClick="return ok2Go('ED');" /><br /><br /><br />
</form>
If I load the page, make a change to the source, and try to reload I get the outstanding references error. I modified wwWebListControl :: ClearItems in webcontrol.prg per your example. Do I also need to change wwWebListControl :: Dispose?
--stein
Can you give me an example? I used your radio button example which worked fine.
Anything that gets added via AddControl() adds to the Items collection and should be removed by the dispose() call. It seems to work for me here. Did you put this in the right place? wwWebListControl :: Dispose and ClearItems().
+++ Rick ---
I think that made it worse. List controls that are populated manually through the code behind now hang also.
~bob
Yeah I noticed this yesterday too as I was looking at Luca's example. I had to stop and start.
Hanging reference there for sure have to see what's happening. Odd that it fires the first time though...
Ok, took a look. I think the issue is that the list items aren't cleaning up. In fact this is a problem for all list controls not just the RadioButtonList (ie. listbox, dropdownlist).
The fix is to explicitly call Dispose() on the child items:
FUNCTION ClearItems()
LOCAL lnX
FOR lnX = 1 TO this.Items.Count
lnItem = this.Items.aItems[lnX]
lnItem.Dispose()
ENDFOR
THIS.Items.Clear()
this.DataSource = ""
ENDFUNC
This seems to fix the problem and make changes work again.
+++ Rick ---
Hi Rick,
Drop a radio list on an empty page and explicitly add some items as shown below and hit it. Then make a change and hit it again, you will get this error:
Compilation Error: File cannot be closed because outstanding references exist.
<ww:wwWebRadioButtonList ID="wwWebRadioButtonList1" runat="server">
<asp:ListItem>Item 1</asp:ListItem>
<asp:ListItem>Item 2</asp:ListItem>
<asp:ListItem>Item 3</asp:ListItem>
<asp:ListItem>Item 4</asp:ListItem>
<asp:ListItem>Item 5</asp:ListItem>
</ww:wwWebRadioButtonList>
I stepped through wwControl.Dispose() and can see your code to explicitly release child controls firing on the first hit and working as designed. On the second hit (after a change was made to the page that requires a recompile), Dispose() is not called for the radio control or any others after it on the page.
That's as far as I got debugging this.
~bob