Questions tagged [destroy]

In object-oriented languages, objects need to be destroyed after their creation to free memory. Destruction can however have a broader meaning. Sometimes, destruction means that resources must be freed or that files must be deleted.

In object-oriented languages, objects need to be destroyed after their creation to free memory. This is not necessarily something that a programmer needs to explicitly instruct. Garbage collected languages such as Java or Python take care of object destruction for you. Other languages such as C++ require the programer to destroy objects explicitly.

Destruction can however have a broader meaning. Sometimes, destruction means that resources must be freed or that files must be deleted.

982 questions
7
votes
3 answers

How to destroy inline CKEditor with jQuery

Let's say that this is code I have:
// This is working for me $('.editor').click(function(){ $(this).ckeditor(); }); // This is the problem $('.editor').on('focusout', function(){ …
Shone Tow
  • 497
  • 4
  • 14
7
votes
4 answers

Unbind/Destroy fancybox 2 events

I am having a strange issue, I have code that pulls content via ajax and then binds Fancybox (2) to certain elements. The issue is that when I "refresh" this page I call the same function that pulls and binds Fancybox again. My normal approach that…
Nick
  • 93
  • 1
  • 1
  • 6
7
votes
2 answers

Why is Destroy not called?

Given the following Delphi code, Foo is Free'd on FormClose, but TFoo.Destroy is not being called - and therefore Bar is not Free'd, leading to a memory leak? Have I missed something here or shouldn't Foo.Free call Foo.Destroy at some point? type …
Steve Magness
  • 863
  • 14
  • 25
6
votes
4 answers

Rails :dependent => destroy, want to call another action instead of destroy

I have a has_many :through model that works perfectly. has_many :varietals has_many :grapes, :through => :varietals, :dependent => :destroy I would like to call another action instead of :destroy. In fact, I don't want to nullify the item OR…
alex.bour
  • 2,842
  • 9
  • 40
  • 66
6
votes
3 answers

SurfaceView with camera preview is not destroyed

I have a Tab Activity with 2 tabs (activities). Each tab has a 3d Open GL scene drawn on top of a SurfaceView with camera preview. Yet, depending on device orientation, tabs are being switched. The problem is that when the other activity starts, it…
Kirill Volkov
  • 942
  • 1
  • 9
  • 18
6
votes
1 answer

Rails session gets destroy whenever model destroy link is clicked

If I click destroy on any record for my 3 models models, the user gets logged out. I'm using Devise and Ominauth. #This logs out a user def destroy @rating = Rating.find(params[:id]) @rating.destroy end Started POST "/ratings/29" for…
spectro
  • 219
  • 1
  • 10
6
votes
2 answers

Detecting global destruction in Perl

I'd like to detect if my object is being DESTROY'd as part of global destruction, and print out a warning (as that'd clearly be an error and lead to data loss). The obvious way to do that would seem to be: sub DESTROY { my $self = shift; #…
derobert
  • 49,731
  • 15
  • 94
  • 124
6
votes
2 answers

How can I run clean-up code in a Rust library?

I am making an crossplatform terminal library. Because my library changes the state of the terminal, I need to revert all the changes that are made to the terminal when the process ends. I am now implementing this feature and thinking of ways how to…
Timon Post
  • 2,779
  • 1
  • 17
  • 32
6
votes
3 answers

Remove Model and Table so can start again in Rails

I created a model for comments at the start of a project, but have now come to the realisation I need to create some polymorphic relations so I can use comments with a number of other models as well. Considering the the code I already have etc, I'm…
6
votes
4 answers

Delete / Destroy is not working in rails 3 with jQuery

My delete/destroy is not working for Rails 3. Not for any scaffold or even for new projects. <%= link_to 'Destroy', card, :confirm => 'Are you sure?', :method => :delete %> From this question. Solution is Firefox reinstalation. But mine is also…
Mohit Jain
  • 43,139
  • 57
  • 169
  • 274
6
votes
0 answers

Angularjs $destroy childHead to reduce memory leak possibly from ui-router

My app is using ui-router. I have noticed that memory keeps increasing when changing routes. I have checked the code for the usual stuff like event binding, destroy of elements etc. but still I get more that 50% of the initial memory when the app is…
GEOCH
  • 61
  • 1
6
votes
3 answers

PHP - Session_Destroy upon pressing Back button

Here is my issue: I have a login page called login.php (containing no HTML code). When the user types in his credentials correctly he's redirected to a specific page; we'll say test.php for this example. The only links on that page logout of the…
Seth
  • 665
  • 1
  • 7
  • 16
6
votes
3 answers

Android Activity Intent remains after shutdown

SETUP One Activity, SingleTop, receives an intent from a notification. Intent is consumed by activity. User hits back button to end the activity. onDestory gets called and isFinishing() returns true. Long press Home key to bring up recent apps.…
LEO
  • 2,572
  • 1
  • 26
  • 31
5
votes
2 answers

How to know when the model is destoyed automatically by a :dependent => :destroy in rails?

I have the following association: class Parent < ActiveRecord::Base has_many :children, :dependent => :destroy before_destroy :do_some_stuff end class Child < ActiveRecord::Base belongs_to :parent before_destroy :do_other_stuff end I would…
5
votes
1 answer

How to avoid N+1 queries in rails dependent destroy?

Class User < ActiveRecord::Base has_many :posts, dependent: :destroy end Class Post < ActiveRecord::Base belongs_to :user end When a User having N posts is destroyed, N+1 queries are run to destroy the associated posts and the user. How to…