/// <summary>
 /// Does cleanup when the main widget is destroyed
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void _mainWidget_Destroyed(object sender, EventArgs e)
 {
     if (numberLockedCols > 0)
     {
         gridview.Vadjustment.ValueChanged     -= Gridview_Vadjustment_Changed;
         gridview.Selection.Changed            -= Gridview_CursorChanged;
         fixedcolview.Vadjustment.ValueChanged -= Fixedcolview_Vadjustment_Changed1;
         fixedcolview.Selection.Changed        -= Fixedcolview_CursorChanged;
     }
     // It's good practice to disconnect the event handlers, as it makes memory leaks
     // less likely. However, we may not "own" the event handlers, so how do we
     // know what to disconnect?
     // We can do this via reflection. Here's how it currently can be done in Gtk#.
     // Windows.Forms would do it differently.
     // This may break if Gtk# changes the way they implement event handlers.
     ClearGridColumns();
     gridmodel.Dispose();
     if (imagePixbuf != null)
     {
         imagePixbuf.Dispose();
     }
     if (image1 != null)
     {
         image1.Dispose();
     }
     if (table != null)
     {
         table.Dispose();
     }
     _mainWidget.Destroyed -= _mainWidget_Destroyed;
     _owner = null;
 }
Beispiel #2
0
        public override void loadFileCharacteristics()
        {
            // We used path but in a wrong way...
            Path = System.IO.Path.GetFullPath(Path);
            Gtk.Image image = new Gtk.Image(Path);
            DimensionsY = image.Pixbuf.Height;
            DimensionsX = image.Pixbuf.Width;
            Title       = System.IO.Path.GetFileName(Path);
            Author      = "";
            FileStream oFileStream;

            oFileStream = new FileStream(Path, FileMode.Open, FileAccess.Read);
            Length      = DimensionsX.ToString() + "x" + DimensionsY.ToString();
            image.Dispose();
            image = null;
        }
Beispiel #3
0
 /// <summary>
 /// Called when the main widget is destroyed.
 /// Detaches event handlers.
 /// </summary>
 /// <param name="sender">Sender object.</param>
 /// <param name="args">Event data.</param>
 private void OnMainWidgetDestroyed(object sender, EventArgs args)
 {
     try
     {
         image.Drawn -= OnImageExposed;
         image.Dispose();
         (PropertiesView as PropertyView).Dispose();
         container.ButtonPressEvent   -= OnButtonPress;
         container.ButtonReleaseEvent -= OnButtonRelease;
         container.ScrollEvent        -= OnMouseScroll;
         container.Destroyed          -= OnMainWidgetDestroyed;
     }
     catch (Exception err)
     {
         ShowError(err);
     }
 }