Hi all
I have a list of Componet objects and put them in Containner, after
container is disposed then components doesn't disposed
I write some code example
Component c = new Component();
using(Container list = new Container()) {
list.Add(c, "c");
ISite site = c.Site;
...
}
but after this code c is not null
but in Container dispose method look like this
protected virtual void Dispose(bool disposing)
{
ISite site1;
int num1;
if (!disposing)
{
return;
}
Container container1 = this;
lock (container1)
{
while ((this.siteCoun t > 0))
{
num1 = (this.siteCount - 1);
this.siteCount = num1;
site1 = this.sites[num1];
site1.Component .Site = null;
site1.Component .Dispose();
}
this.sites = null;
}
}why c is not null, if container dispose themwith best regardsViorel Ghilas 1 4891
Hi Viorel,
The component is disposed. Disposing an object means that the object
probably freed some unmanaged resources. The object itself is still alive
and it is going to be alive until after there are no more references to it
and GC kick off and cleaned up the garbage. So, c will never be null in your
code.
There is no way using Component class to find out whether the componet has
been disposed. Controls, though, have property IsDisposed.
--
HTH
Stoitcho Goutsev (100) [C# MVP]
"Viorel Ghilas" <vg*****@hotmai l.com> wrote in message
news:O5******** ******@TK2MSFTN GP09.phx.gbl... Hi all
I have a list of Componet objects and put them in Containner, after container is disposed then components doesn't disposed
I write some code example Component c = new Component();
using(Container list = new Container()) { list.Add(c, "c"); ISite site = c.Site; ... }
but after this code c is not null
but in Container dispose method look like this protected virtual void Dispose(bool disposing) { ISite site1; int num1; if (!disposing) { return; } Container container1 = this; lock (container1) { while ((this.siteCoun t > 0)) { num1 = (this.siteCount - 1); this.siteCount = num1; site1 = this.sites[num1]; site1.Component .Site = null; site1.Component .Dispose(); } this.sites = null; } }why c is not null, if container dispose themwith best regardsViorel
Ghilas This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Tim Conkling |
last post by:
I've run into a problem with a game I'm designing -- I (think) I need
to do something ugly, for speed reasons, and I'm wondering if people
here might have any ideas about how solve my problem more elegantly:
I'm using a templated container that I created for this project that
sorts objects based on a numerical value. That is, each object in the
container has an integer value associated with it, and objects with
lower integer values come...
|
by: forester |
last post by:
lets say its common situation when object have subobjects in container
and receives callbacks from contained items. and object want to move
objects in containers on signal(callback).
iterator is needed for container modifications, item cannot know its
iterator, at least its not easy to do so and i think cannot be done
type-safe avoiding virtual functions and stuff.
'this' pointer from items is a freeby :>.
the problem is, std...
|
by: bg |
last post by:
Hi!
How do I check if "date" exists before using that code?
I've built a RSSreader and sometimes there's a date in it and sometimes not.
How can I check if it exists to avoid crash (DataBinder.Eval:
'System.Data.DataRowView' does not contain a property with the name date)
<asp:DataGrid
id="RssNewsGrid"
|
by: PengYu.UT |
last post by:
In the following program, I want an iterator contain pointer pointing
to constant object not const pointer. If it is possible would you
please let me know how to do it?
#include <boost/shared_ptr.hpp>
#include <vector>
#include <iterator>
#include <iostream>
class trial {
|
by: food4uk |
last post by:
Dear all :
I am not good at programming, please give a hand.
My data structure is very similar as an array. I actually can use the
std::vector as container to organize my data objects. However, the
behaviours of std::vector::iterator can not meet my requirements. I
need to redefine the vector::iterator's behavious such as ++. It means
"next position in the object sequence" in STL but now I redefine it to
mean "next position within a 2-d...
| |
by: Daniel Lipovetsky |
last post by:
I would like for an object to "report" to a container object when a
new instance is created or deleted. I could have a container object
that is called when a new instance is created, as below.
class AnyObject:
pass
class Container:
links =
def add(self,other):
|
by: Jess |
last post by:
Hello,
Is it possible to put object references into a container, such as a
vector? I tried the following, but the compiler gave me lots of error
messages.
struct A{
int x;
};
|
by: arnaudk |
last post by:
Hello,
I am relatively new to C++ and have been milling over a container related problem for a while now. I have a ~2Gb ASCII file of time-ordered data with 4 comma-separated columns. The first column is a string identifier, the second and third are date and time, and the last two some numerical data, e.g.:
frog, 10/06/2006, 23:56:03, 12.3456, 322.551
frog, 11/06/2006, 22:00:06, 6.12136, 41.1236
fish, 12/06/2006, 09:01:54, 1.3456, 0.3321...
|
by: Goran |
last post by:
Hi @ all!
Again one small question due to my shakiness of what to use...
What is better / smarter?
private:
vector<MyClass_t* itsVector;
OR...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
| |
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |