I had an interesting (to me, anyway) situation:
I have a program which, if a user presses a button, opens a new window
containing various text entries, textviews, and radiobuttons. The new window
also contained a checkbutton. The state of the radiobuttons and checkbutton
were stored in flags
On Tue, 3 Dec 2013 19:59:22 -0800 (PST)
David Buchan pdbuc...@yahoo.com wrote:
ok, I may be getting somewhere. I did some reading on heap memory
versus stack.
Here's a vastly simplified example program which doesn't use GTK+,
but I'm using to demonstrate my plan of attack.
I use
On 4 December 2013 13:31, jcup...@gmail.com wrote:
Here's a tiny, complete program that does almost what you want. It's
gtk2, but should work fine with gtk3.
http://pastebin.com/PsG2UDkY
It just updates a status bar, but it'd be easy to make it do a textview
instead.
John
On Wed, Dec 4, 2013 at 2:59 PM, David Buchan pdbuc...@yahoo.com wrote:
// Allocate memory on the heap, not stack.
msgdata = (msgdatas *) malloc (1 * sizeof (msgdatas));
msgdata-textview = (int *) malloc (1 * sizeof (int));
message = (char *) malloc (1024);
The only blocks of memory
On Thu, Dec 5, 2013 at 2:00 AM, David Buchan pdbuc...@yahoo.com wrote:
Things I've learned yesterday are:
1. strdup() (I've never seen or used it before)
2. what the heck heap and stack mean (still more to learn there)
3. a more general and flexible solution is probably to use asynchronous
These darn threads and idle functions still baffle me. I'm sorry to be such a
pest.
I want to periodically update a textview as new information comes available.
Sometimes this information can come in quickly (roughly every tenth of a
second). Each update is a single line of text.
The observed
David Buchan pdbuc...@yahoo.com wrote:
These darn threads and idle functions still baffle me. I'm sorry to
be such a pest.
I want to periodically update a textview as new information comes
available.
Sometimes this information can come in quickly (roughly
every tenth of a second
David Buchan pdbuc...@yahoo.com wrote:
[snip]
It is awkward, and probably unnecessary. Unless you have a very good
reason, that is not the way to do it. Pass the idle function a string
allocated on the heap, and free it in the idle function when finished
with. Any other way creates thread
ok, I may be getting somewhere. I did some reading on heap memory versus stack.
Here's a vastly simplified example program which doesn't use GTK+, but I'm
using to demonstrate my plan of attack.
I use a function called packit() which allows me to still use strdup().
Comments?
Dave
Valgrind
On Wed, 27 Nov 2013 19:32:26 -0800 (PST)
David Buchan pdbuc...@yahoo.com wrote:
I removed the call to g_thread_init() and it still works fine! Great
catch there.
You can include it with glib = 2.32 - it is a no-op then. You should
include it if you want your code to be able to run on earlier
Hi Andrew,
Yes, I've tried the printf thing. It takes about 1.5 sec. Very strange.
Dave
From: Andrew Potter agpot...@gmail.com
To: David Buchan pdbuc...@yahoo.com
Cc: gtk-app-devel-list list gtk-app-devel-list@gnome.org
Sent: Wednesday, November 27, 2013
:29 AM, David Buchan wrote:
I have written a program which spawns a new thread when the user
clicks a button. The new thread does something noticeable immediately
after starting, so I know when the thread has begun. What I mean is,
if I run that piece of code that is executed as a new thread
David Buchan pdbuc...@yahoo.com wrote:
Hi Michael,
My 32-bit, GTK+2 version does
// Secure glib
if (!g_thread_supported ()) {
g_thread_init (NULL);
}
at the beginning, and then the thread is spawned via:
on_button1_clicked (GtkButton *button1, MyData *data
David Buchan pdbuc...@yahoo.com wrote:
Hi Michael,
My 32-bit, GTK+2 version does
// Secure glib
if (!g_thread_supported ()) {
g_thread_init (NULL);
}
at the beginning, and then the thread is spawned via:
on_button1_clicked (GtkButton *button1, MyData *data
I have a rather large program I've written in C language which uses GTK+2. My
Makefile has:
CCFLAGS = `pkg-config --cflags gtk+-2.0 gmodule-2.0`
LIBS = `pkg-config --libs gtk+-2.0 gmodule-2.0`
GCC compiles it without warnings using flags:
-Wall -O -Wuninitialized
My program has several
trouble with g-sliced memory?
From: David Buchan pdbuc...@yahoo.com
To: gtk-app-devel-list list gtk-app-devel-list@gnome.org
Sent: Tuesday, November 5, 2013 12:47 PM
Subject: Valgrind is grinding my gears
I have a rather large program I've written in C language
when freeing -
https://developer.gnome.org/glib/unstable/glib-Memory-Slices.html
I do indeed change dimensions of arrays declared within my struct (a lot, in
fact). Could this be the cause?
From: David Buchan pdbuc...@yahoo.com
To: gtk-app-devel-list list gtk-app
essentially what using
G_SLICE=always-malloc would do.
I can't try this out until late tonight, unfortunately.
From: David Nečas y...@physics.muni.cz
To: David Buchan pdbuc...@yahoo.com
Cc: gtk-app-devel-list list gtk-app-devel-list@gnome.org
Sent: Tuesday
Aaaah. I see.
Thanks guys.
From: Bernhard Schuster schuster.bernh...@gmail.com
To: David Buchan pdbuc...@yahoo.com
Cc: David Nečas y...@physics.muni.cz; gtk-app-devel-list list
gtk-app-devel-list@gnome.org
Sent: Tuesday, November 5, 2013 3:59 PM
Subject
Great! Thanks!
Dave
From: jcup...@gmail.com jcup...@gmail.com
To: David Buchan pdbuc...@yahoo.com
Cc: gtk-app-devel-list list gtk-app-devel-list@gnome.org
Sent: Tuesday, November 5, 2013 4:56 PM
Subject: Re: Valgrind is grinding my gears
I have
might be able to
build GTK+3, but that's likely a lot of work. So had in mind producing two
binaries for the distribution tarball.
From: Emmanuele Bassi eba...@gmail.com
To: David Buchan pdbuc...@yahoo.com
Cc: gtk-app-devel-list list gtk-app-devel-list@gnome.org
I am using Ubuntu 13.04.
Rumour on the street (I *think* I read it somewhere) is that I can install both
libgtk2.0-dev and libgtk-3-dev. Is that true? Can they both be installed
without interfering with each other, and without breaking Unity?
I'd like to be able to provide executables of my
I've created a table with Glade and put various widgets in some of the cells.
Ifin one particular rowI have: a label,a text entry, and finally a few cells
that I don't need to put anything into, should I place blank labels in those
last unused cells, or just leave them unspecified? Would there
Based on recent discussion on threads/idles/timeouts, I wonder if I
could get confirmation that what I'm doing to remove deprecated stuff is
correct.
Current Situation:
Ubuntu 10.04
libgtk2.0-dev
3.7.0.is.3.6.7-0ubuntu1
Makefile contains:
CCFLAGS = `pkg-config --cflags gtk+-2.0 gmodule-2.0`
Hi,
I've made a program that creates two new windows when demanded:
GtkWidget *window1, *scrolled_win1, *textview1;
GtkTextBuffer *buffer1;
GtkWidget *window2, *scrolled_win2, *textview2;
GtkTextBuffer *buffer2;
PangoFontDescription *textview_font1;
PangoFontDescription
Frank wrote:
You don't have a .local directory in /root
Should I?
From: Frank Cox thea...@melvilletheatre.com
To: gtk-app-devel-list@gnome.org
Cc: David Buchan pdbuc...@yahoo.com
Sent: Saturday, July 21, 2012 1:10 AM
Subject: Re: Unusual GTK error message
Background info: My program uses a file chooser dialog. I compiled it for the
first time today on a 64-bit machine with Ubuntu 12.04 64-bit with gtk-3-dev.
My program is run as root. I've been using it extensively on 32-bit machine
with libtgtk2.0-dev and Ubuntu 10.04 with no errors.
When I
Additional info:
The first two errors appear when I press the Open button in the file chooser
dialog.
The third error appears when I close my program completely.
Dave
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
Well, that worked out fine!
It creates a smooth user interface experience.
Thanks again John.
Dave
From: jcup...@gmail.com jcup...@gmail.com
To: David Buchan pdbuc...@yahoo.com
Cc: gtk-app-devel-list list gtk-app-devel-list@gnome.org
Sent: Friday, July 6
From: jcup...@gmail.com jcup...@gmail.com
To: David Buchan pdbuc...@yahoo.com
Cc: gtk-app-devel-list list gtk-app-devel-list@gnome.org
Sent: Friday, July 6, 2012 3:56 AM
Subject: Re: yet another thread question
Hi again David,
On Friday, 6 July 2012, David Buchan wrote:
When the user
Wow!
Absolutely fantastic.
Thanks again John.
Dave
From: jcup...@gmail.com jcup...@gmail.com
To: David Buchan pdbuc...@yahoo.com
Cc: gtk-app-devel-list list gtk-app-devel-list@gnome.org
Sent: Friday, July 6, 2012 10:16 AM
Subject: Re: yet another thread
Is there a way to have a (non-main iteration) thread issue a signal when it
ends?
I start up a timeout and an idle function when I spawn a new thread.
I want the main iteration to stop the timeout and idle function as soon as the
new thread is finished and disappears.
It seems to me that if
this is the easiest
solution.
From: David Buchan pdbuc...@yahoo.com
To: gtk-app-devel-list list gtk-app-devel-list@gnome.org
Sent: Thursday, July 5, 2012 9:26 AM
Subject: Another thread/idle/timeout question
Is there a way to have a (non-main iteration) thread issue
Aaaah.. I see.
Yes, that's exactly what I meant.
That's great! Thanks.
From: jcup...@gmail.com jcup...@gmail.com
To: David Buchan pdbuc...@yahoo.com
Cc: gtk-app-devel-list list gtk-app-devel-list@gnome.org
Sent: Thursday, July 5, 2012 11:32 AM
Subject: Re
When the user presses a button, an idle function is begun to watch a flag which
will tell it a message has been left in a string for it by a worker thread. The
worker thread is then started. It will produce results to be displayed in a
textview by the idle function. When the worker thread has
My understanding is that child threads must never alter the UI in any way.
If I have a program which spawns a child thread to download some data and I
want to be able to have a dialog pop up should an error occur, is it correct to
say that I need an idle function to be running concurrently to
yep. Seems to be working.
Thanks!
Dave
From: James Morris jwm.art@gmail.com
To: David Buchan pdbuc...@yahoo.com
Sent: Monday, July 2, 2012 9:10 PM
Subject: Re: Threads and idle functions
On 3 July 2012 01:50, David Buchan pdbuc...@yahoo.com wrote:
My
37 matches
Mail list logo