57 questions
31
votes
7
answers
39k
views
Self deletable application in C# in one executable
Is it possible to make an application in C# that will be able to delete itself in some condition.
I need to write an updater for my application but I don't want the executable to be left after the ...
7
votes
8
answers
3k
views
Is it OK to use "delete this" to delete the current object?
I'm writing a linked list and I want a struct's destructor (a Node struct) to simply delete itself, and not have any side effects. I want my list's destructor to iteratively call the Node destructor ...
17
votes
4
answers
10k
views
Delphi: Is it ok for a form to free it self?
I have a form that I use to show some information for some seconds. Is it ok for the form to free itself? Can I start a timer in the constructor, and then call self.free in the timer-event? Or will ...
36
votes
10
answers
30k
views
Is it safe to `delete this`? [duplicate]
In my initial basic tests it is perfectly safe to do so. However, it has struck me that attempting to manipulate this later in a function that deletes this could be a runtime error. Is this true, ...
6
votes
3
answers
8k
views
How can a object self destruct on an event, in javascript?
I have this function, to create a DIV on-the-fly. But now, I want to destroy this object on onclick event, but I just don't know how.
function creatediv(id) {
var newdiv = document.createElement(...
25
votes
11
answers
22k
views
Should objects delete themselves in C++?
I've spent the last 4 years in C# so I'm interested in current best practices and common design patterns in C++. Consider the following partial example:
class World
{
public:
void Add(Object *...
30
votes
4
answers
7k
views
What is the use of "delete this"?
Today, I have seen some legacy code. In the destructor there is a statement like "delete this". I think, this call will be recursive. Why it is working?
I made some quick search on Y!, I found that ...