On 08/20/2013 04:44 AM, Markus Elfring wrote:
HelloWorld::HelloWorld() : m_textview() {
add(m_textview);
m_textview.show();
Glib::Thread::create(sigc::mem_fun(*this, &HelloWorld::cpp_app),
true);
}
[...]
void HelloWorld::cpp_app() {
string texttoprint = "";
Glib::RefPtr<Gtk::TextBuffer> m_refTextBuffer;
m_refTextBuffer = Gtk::TextBuffer::create();
string runit(std::string c);
texttoprint +=
"About to run a number of c++ functions\nand display the
results\n";
m_refTextBuffer->set_text(texttoprint);
m_textview.set_buffer(m_refTextBuffer);
sleep(10); // This sleep function represents any c++ function
performaing a task
I would like to clarify implementation details a bit more from this
programming attempt. Can it be that the referenced text buffer is
written in a thread-unsafe way here?
How do think about to apply improved techniques and software
ingredients like locks for memory consistency?
(Andrew Potter and Gavin Lambert suggested also an alternative program
structure. -
https://mail.gnome.org/archives/gtkmm-list/2013-August/msg00135.html )
Regards,
Markus
Makus. As always I appreciate your taking the time to give input.
The lines that you quote are almost identical to the lines in the
documentation, HelloWorld (the first example of the Gtkmm
documentation). It's totally modeled after Alan's submission of which I
linked to. The only difference is Alan's submission uses the label
widget and the one you're quoting above uses textview. I could be wrong
and you might see something else subtle that I'm missing. If you could
specify specifically I'll message Alan for help to make whatever change
you suggest, if it would be applicable. But I can't make changes at
this time. It's working perfectly and making changes would brake it.
Again, I'd gladly test any lines that you post and tell you if the code
still works.
-- L. James
--
L. D. James
lja...@apollo3.com
www.apollo3.com/~ljames
_______________________________________________
gtkmm-list mailing list
gtkmm-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtkmm-list