Bug 40467 - animation in the drawingArea stops without events about error
Summary: animation in the drawingArea stops without events about error
Status: NEW
Alias: None
Product: Gtk#
Classification: Mono
Component: gtk-sharp ()
Version: 2.x
Hardware: PC Linux
: --- normal
Target Milestone: ---
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2016-04-17 10:15 UTC by Roman
Modified: 2016-04-17 14:04 UTC (History)
1 user (show)

Tags:
Is this bug a regression?: ---
Last known good build:


Attachments
Packed project (3.48 MB, application/gzip)
2016-04-17 10:15 UTC, Roman
Details


Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report for Bug 40467 on GitHub or Developer Community if you have new information to add and do not yet see a matching new report.

If the latest results still closely match this report, you can use the original description:

  • Export the original title and description: GitHub Markdown or Developer Community HTML
  • Copy the title and description into the new report. Adjust them to be up-to-date if needed.
  • Add your new information.

In special cases on GitHub you might also want the comments: GitHub Markdown with public comments

Related Links:
Status:
NEW

Description Roman 2016-04-17 10:15:18 UTC
Created attachment 15743 [details]
Packed project

Week ago I begin to learn Gdk, Cairo, Pango, Glade. I have discribed wonderfull world of GUI in linux environment. "Great!" - said I for myself.

I Create two similar projects GTK#: first of them is with using Cairo; second of them is without Cairo.

Both of them draw some animation on drawingArea.

I set doubleBuffered = true in both projects;

So first project works without problem but because of using atlas (cutting, coping, zooming parts of atlas) it is easy to use second project.

After start debuging of second project application draw animation but 1-5 minutes later image inside of drawingArea stops (freeze). When I minimize and than maximize application window I get gray canvas with blue title on top. Console output does write me anything.

This is code

using System;
using Gtk;
using Gdk;
using System.Timers;

namespace GTK_Sharp
{
    class MainClass
    {
        [Glade.Widget]
        DrawingArea drawingarea1;

        [Glade.Widget]
        Gtk.Window window1;

        int _x, _y, _dx, _dy;

        Gdk.Pixbuf _pixBuf;
        Gdk.Pixbuf _atlas;
        Gdk.GC gc;
        Pango.Layout layout;

        public static void Main(string[] args)
        {
            new MainClass (args);
        }

        public MainClass (string[] args)
        {
            _x = 0;
            _y = 0;
            _dx = 30;
            _dy = 17;
            Application.Init();
            Glade.XML gxml = new Glade.XML("first.glade", "window1", null);
            gxml.Autoconnect (this);
            _pixBuf = new Gdk.Pixbuf("camera-hands.png");
            _atlas = new Gdk.Pixbuf("Atlas2.png");
            _atlas.CopyArea(531, 1960, 336, 83, _atlas, 0, 0);
            gc = drawingarea1.Style.BaseGC(StateType.Normal); 
            layout = new Pango.Layout(drawingarea1.PangoContext);
            drawingarea1.ModifyBg(StateType.Normal, new Color(255,255,255));
            drawingarea1.ExposeEvent += OnExposed;
            new System.Threading.Thread(Run){ IsBackground = true }.Start();
            window1.DeleteEvent+= Window1_DeleteEvent;
            Application.Run();
        }

        void Window1_DeleteEvent (object o, DeleteEventArgs args)
        {
            Application.Quit ( );
            args.RetVal = true;
        }

        void Run()
        {
            while (true)
            {
                _y += _dy;
                _x += _dx;
                if (_x > 1100 || _x < 0)
                    _dx = -_dx;
                if (_y > 860 || _y < 0)
                    _dy = -_dy;
                System.Threading.Thread.Sleep(20);
                drawingarea1.GdkWindow.InvalidateRect(new Gdk.Rectangle(0, 0, 1280,1024), false);
            }
        }

        void OnExposed (object o, ExposeEventArgs args)
        {
            drawingarea1.GdkWindow.DrawPixbuf(gc, _pixBuf, 0,0,_x,_y,182,162,RgbDither.None, 0,0);
            drawingarea1.GdkWindow.DrawPixbuf(gc, _atlas, 0,0,_x-75,_y+40,336, 83,RgbDither.None, 0,0);
            layout.Width = Pango.Units.FromPixels(500);
            layout.Wrap = Pango.WrapMode.Word;
            layout.Alignment = Pango.Alignment.Left;
            layout.FontDescription = Pango.FontDescription.FromString("Ahafoni CLM Bold 20");
            layout.SetMarkup("<span color=\"blue\">It’s like setting up text in word or writer. You can have indents, sizes, fonts, etc etc. In this example Pango.Layout, the width is set by converting the window width into pango units because layouts are not measured in pixels. The wrap goes hand in hand with width so that any long text will wrap at the set width value. The FontDescription is quite handy. Here you can define your font. Thanks go to TD on the #mono channel for his tips here. If you want to know the names of available fonts you can enter here, go to gedit and look at the available font names. In the example above, I have the font name of “Ahafoni CLM”, the weight of “Bold” and size of 100.</span>");
            drawingarea1.GdkWindow.DrawLayout(gc, 0, 0, layout);
        }
    }
}

Mono version 4.2.3
Linux Lubuntu 14.10
desktop environment is lightDM

Also I attach for you full project with resources and glage-file in /bin/Debug

I'm sorry if my english is not so advanced
Comment 1 Roman 2016-04-17 14:04:45 UTC
Hm, I'm sorry but first project with cairo has this problem too. But troubles has come later more time than in second project