From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=unavailable autolearn_force=no version=3.4.4 Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!news.eternal-september.org!news.eternal-september.org!feeder.eternal-september.org!aioe.org!.POSTED!not-for-mail From: "Dmitry A. Kazakov" Newsgroups: comp.lang.ada Subject: Re: Gtk3 Cairo Context 0x0 Date: Fri, 22 Jul 2016 08:01:25 +0200 Organization: Aioe.org NNTP Server Message-ID: References: <5790df74$0$32235$e4fe514c@news.kpn.nl> NNTP-Posting-Host: xelDFTENDI+dlkJFd2Ot2w.user.gioia.aioe.org Mime-Version: 1.0 Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit X-Complaints-To: abuse@aioe.org User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.2.0 X-Notice: Filtered by postfilter v. 0.8.2 Xref: news.eternal-september.org comp.lang.ada:31117 Date: 2016-07-22T08:01:25+02:00 List-Id: On 2016-07-21 16:42, ldries46 wrote: > I am creating a new Drawing_Area. > I have packed the drawing Area in a Viewport which is packed in a > scrolled window. > Now have the program line: > CR := Create(Get_Window (MainWindow.DrawingArea)); > where MainWindow.DrawingArea is type Gtk_Drawing_Area with the value > 0x4694f98 (meaning the value is no null) > created with Gtk_New (MainWindow.DrawingArea); > The Cairo context CR has however a value 0x0 which finally results when > using Save(CR); > in: > Program received signal SIGSEGV, Segmentation fault. > cairo_save (cr=0x0) at ../../src/src/cairo.c:409 > 409 ../../src/src/cairo.c: No such file or directory. > Current language: auto > The current source language is "auto; currently c". > > In the version 2015 of GtkAda from AdaCore the create function worked > and was positioned after the creation of the Drawing Area but before the > connection to the "draw" event. > On the Gtkada group I do get only the answer that only in the handler That is right. [There are rare cases when memory-mapped contexts used, but drawing area presumes a normal window's drawing context.] > I can get the context but that means that I cannot create a framework > within the area before any work with on the area because therefore I > need the cairo context f.i. to set s line color. Which framework? Whatever you might do with a context is useless if the context is not the one used for drawing onto the actual window. That one you get in the handler. When initialization is needed do it upon the first call. > What must I do to retrieve a valid CR? It does not work this way, you must reconsider your design. -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de