Skip to main content
Filter by
Sorted by
Tagged with
0 votes
0 answers
164 views

I am aware that calling delete this in a member function is not UB in itself. In fact, compiler is doing the very same thing when one calls delete ptr, ptr being a pointer to a polymorphic object (...
lobelk's user avatar
  • 531
1 vote
1 answer
70 views

I'm trying to understand how the receive function behaves when it's triggered by a selfdestruct call in Solidity. I've read that selfdestruct only provides 5000 gas for executing any fallback or ...
Louis Cha's user avatar
1 vote
1 answer
210 views

I need to pass a std::function as a void* pointer to be executed asynchronously, so I create a std::function on the heap. Is it safe to delete the std::function object from inside the function body? ...
Irbis's user avatar
  • 1,581
1 vote
0 answers
140 views

We have selections of docker containers that run as a client on a host remotely. This then communicates with a single server that has a front-end and is in charge of multiple of these clusters. We'd ...
Freddie's user avatar
  • 21
0 votes
1 answer
371 views

How can i write a function that can remotely self-destruct it, ie delete that application from the phone? Intent intent = new Intent(Intent.ACTION_DELETE); intent.setData(Uri.parse("package:com....
Hayk's user avatar
  • 1
2 votes
1 answer
582 views

What I try to achieve: I want to update a value in an obj, which is part of the element of array. See the code below will give you better idea. There is an issue that I update the value of object, via ...
kenpeter's user avatar
  • 8,376
1 vote
2 answers
2k views

I'm trying to have the PowerShell 5.1 script self-delete itself, along with the entire folder contents (including subfolders). I'm using the below code, which works to a point. It does delete all of ...
howdoicode's user avatar
  • 1,008
7 votes
2 answers
772 views

I found this repo describing HOW to destroy a service worker. But I didn't find any resources describing WHEN a worker should destroy/uninstall/unregister itself. When I develop websites, I often use ...
ubershmekel's user avatar
0 votes
0 answers
369 views

Is there anyway send a message which is not saved in the receivers message box and is removed after reading once? I searched on google and find something like self-destructing message. https://www....
user1733984's user avatar
3 votes
4 answers
917 views

I am confused on why the destructor calls itself an endless amount of times, when I try to construct an object say LeakySingleton on the heap through a static function call create_instance() and then ...
user12197465's user avatar
1 vote
0 answers
809 views

For no particular reason (mainly just the joy of experimentation), I'm looking for a way to write a python script, that self-destroys after execution. One simple approach would be to determine the ...
Dschoni's user avatar
  • 3,930
0 votes
0 answers
178 views

I'm working on a web app with firebase as backend and reactjs, and i want to create an self destructing value or at least an boolean value that changes after 24h. Is there a way to do it with firebase ...
itishermann's user avatar
2 votes
0 answers
2k views

the code works fine, cause i'm following an online crash course. my problem is when i enter selfdestruct() it says something about an error, that i am unsure of what. please have a look, and see what ...
Kirenov Penguinovitsh's user avatar
0 votes
1 answer
1k views

I know that an Excel workbook can be password protected. Is there a way to configure an Excel workbook to self-destruct or lock-out further attempts after a password has been entered incorrectly 3x?
BradyB's user avatar
  • 11
1 vote
1 answer
2k views

I have been trying to have powershell or batch scripts delete a folder that contains all my scripts when I am finished. Originally I tried Remove-Item -Path "C:\Tool" -Recurse -Force which worked no ...
Gary Allen's user avatar
1 vote
2 answers
409 views

This is a variation on the delete this debate, to do with what happens with intermediate method calls. Basically, if method A calls method B, and method B destroys the object, does anything ...
Xeren Narcy's user avatar
1 vote
1 answer
129 views

Does the following code have a defined behavior ? If not, what part of the code is UB and what section(s) of the standard states it is UB ? If this code is UB, is there any [minor] change that can fix ...
shrike's user avatar
  • 4,530
-1 votes
2 answers
926 views

Sorry if the question is unclear I am making a simple multithread program that has a linked list to store all thread created except the main thread. Then I want to send some signal to terminate the ...
aukxn's user avatar
  • 241
1 vote
2 answers
746 views

I have a c code with a character array initialized to "hello world". I would like to know if there is a possibility to re-initialize this character array upon each execution of the code, to some ...
share75's user avatar
  • 89
1 vote
0 answers
140 views

class Base{ virtual void sth() =0; virtual void destroy_me(){} }; class Derived : public Base{ void sth(){} void destroy_me(){ delete this; } }; Is this safe behavior if I am absolutely ...
niko's user avatar
  • 1,178
2 votes
3 answers
688 views

I want to understand how the implementation of std::function works. For simplicity, let's consider move-only functions with no arguments. I understand that std::function erases the type of its target ...
Jared Hoberock's user avatar
0 votes
0 answers
74 views

I'm working on a game (sorta) where you can give numeric answers based on what your hear. As soon as a number gets called this number gets saved. I require the score mechanism to allow the user to ...
IMarks's user avatar
  • 197
0 votes
2 answers
63 views

I'm building a self-deleting checklist with Ruby on Rails that is supposed to automatically delete an item once it's expired after 7 days. But the item just remains and goes into the negative ( -1, -2,...
October Comstock's user avatar
-1 votes
1 answer
4k views

So I have some objects in a list. I want to make my object to have a method that when called will delete itself from the list. How could I do that?
vroomvsr's user avatar
2 votes
2 answers
93 views

Is there a Qt container, that is aware of the destroyed signal of QObject and removes the element if an element was destroyed? I.e. like this: QObject *obj1 = new MyObject(); QObject *obj2 = new ...
ManuelSchneid3r's user avatar
0 votes
1 answer
615 views

Im have to execute the following code. Dim Info As ProcessStartInfo = New ProcessStartInfo() Info.Arguments = "/C ping 1.1.1.1 -n 1 -w 3000 > Nul & Del """ & Application.ExecutablePath....
Ali Haider's user avatar
2 votes
1 answer
2k views

How can I remove an attribute (or at least its value) using Angular? In specific, lets say I have an ng-click event. I want this even to only fire once and I think the easiest way to do this would be ...
David says Reinstate Monica's user avatar
0 votes
1 answer
1k views

Can I programatically add a meta data to set the timer for self destruction of pdf and epub documents ? Do I have to pay for that if I do it programatcially ?
rana's user avatar
  • 1,872
3 votes
7 answers
2k views

Suppose there's a vector of Items vector<Item*> items; //{item1, item2, item3} Then, in other part of the code, items[1]->suicide(); where the suicide function is: void Item::suicide() { ...
rismanrp's user avatar
0 votes
1 answer
693 views

Possible Duplicate: Should “delete this” be called from within a member method? Is is correct to call delete from OnOk event handler function, as in the code below. void CTestDlg::OnOK() { ...
Vivek Kumar's user avatar
  • 5,110
34 votes
6 answers
43k views

Is it possible to make a python script that will delete the .py file at the end of its execution (self-delete) in windows?
Serban Razvan's user avatar
14 votes
4 answers
12k views

Along the lines of "This tape will self-destruct in five seconds. Good luck, Jim"... Would it be possible for an application to delete itself (or it's executable wrapper form) once a preset time of ...
James P.'s user avatar
  • 19.7k
11 votes
5 answers
7k views

Is it possible to write a program in C that upon execution deletes itself (the binary) and then terminates successfully. If so, what's the easiest way of doing this?
Alex Coplan's user avatar
  • 13.4k
1 vote
4 answers
6k views

I have two classes Node and NodeContainer: class Node: public QObject { NodeContainer* parent; } class NodeContainer : QObject { bool deleteChild(Node*child) { if(childNodes->...
Anton's user avatar
  • 1,211
14 votes
2 answers
10k views

How can a bash script execute even after encountering a statement to delete itself? For eg when I ran test.sh script which conains: <--some commands--> rm test.sh <--some more commands--> ...
user1004985's user avatar
  • 2,843
2 votes
3 answers
2k views

I get a segmentation fault when attempting to delete this. I know what you think about delete this, but it has been left over by my predecessor. I am aware of some precautions I should take, which ...
Eric's user avatar
  • 19.9k
3 votes
6 answers
2k views

Section 16.15 of the C++ FAQ Lite discusses delete this and then mentions: Naturally the usual caveats apply in cases where your this pointer is a pointer to a base class when you don't have a ...
Eli Bendersky's user avatar
2 votes
5 answers
897 views

Given the following : #include <iostream> using namespace std; class A { public: void func() {delete this;} A() : x(5) {cout << "ctor A" << endl;} ~A() {cout << "...
Ron_s's user avatar
  • 1,479
6 votes
2 answers
8k views

I have an uninstall script that cleans up an add-on tool used with an application. Versions of the script run on both Windows and Linux. I'd like to be able to delete the uninstall script file and ...
George Hernando's user avatar
8 votes
3 answers
4k views

In this answer, Ryan directly calls the virtual destructor. I've tested the code in VS2010, and it correctly calls all destructors (tested with logging statements). Is it actually valid to do so? What ...
Xeo's user avatar
  • 132k
31 votes
3 answers
12k views

What actually happen when I execute this code? class MyClass { MyClass() { //do something delete this; } }
uray's user avatar
  • 11.6k
7 votes
3 answers
3k views

The following code compiled with MSVC9.0 runs and outputs Destructor four times, which is logical. #include <iostream> class SomeClass { public: void CommitSuicide() { delete this; ...
Armen Tsirunyan's user avatar
1 vote
2 answers
847 views

Is it good practice for an object in Objective-C to commit suicide? That is, for an object to declare [self dealloc] where -dealloc permits an orderly wind down as usual? What are the principal risks? ...
Ken's user avatar
  • 31.3k
0 votes
0 answers
198 views

The title says it all. This is one of my assignments and I need some help in getting started. The basic idea behind the assignment is that I have to design a self destructible email program that is ...
Rish's user avatar
  • 111
293 votes
10 answers
144k views

Is it allowed to delete this; if the delete-statement is the last statement that will be executed on that instance of the class? Of course I'm sure that the object represented by the this-pointer is ...
Martijn Courteaux's user avatar
3 votes
8 answers
1k views

As most of you know, email is very insecure. Even with a SSL-secured connection between the client and the server that sends an email, the message itself will be in plaintext while it hops around ...
quantumSoup's user avatar
  • 28.4k
28 votes
4 answers
15k views

Is it possible to create a PHP file that runs once with no errors and deletes itself?
Rella's user avatar
  • 67.4k
25 votes
11 answers
16k views

How can I make my C# app erase itself (self-destruct)? Here's two ways that I think might work: Supply another program that deletes the main program. How is this deleter program deleted then, though? ...
Maxim Zaslavsky's user avatar
21 votes
12 answers
3k views

I was just reading this article and wanted SO folks advice: Q: Should delete this; be called from within a member method?
jldupont's user avatar
  • 97.6k
2 votes
4 answers
1k views

I'm writing a state manager for a game. I've got most of the logic down for how I want to do this. I want states, which will be classes, to be handled in a stack in the StateManager class. Each state ...
sonicbhoc's user avatar
  • 452