Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7051273
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T03:14:38+00:00 2026-05-28T03:14:38+00:00

In our project, we’re using gtkmm and we have several classes that extend Gtk::Window

  • 0

In our project, we’re using gtkmm and we have several classes that extend Gtk::Window in order to display our graphical interface.

I now found out what call produces the behaviour (described in the previous revision. The question now slightly changed.)

We’re displaying one window, works like a charm.

Then, we have a window which displays various status messages. Let’s call it MessageWindow. It has a method setMessage(Glib::ustring msg) which simply calls a label’s set_text().

After some processing, we hide this window again and we now show a toolbar. Just yet another simple window, nothing crazy.

For all windows applies: The main thread calls show() on the window and creates a new thread which calls Gtk::Main::run() (without argument).

That’s how it should be, until now.

The problem starts here: The main thread now wants to call MessageWindow::setMessage("any string"). a) if I call this method, the message window reacts completely correctly. But afterwards, the toolbar-window is displayed empty. b) if I don’t call it, the message window doesn’t change the label (which is absolutely clear), and the toolbar window is displayed as it should.

Seems like the windows are messing up each other.

Now the question:

If my gui-thread is blocking in Gtk::Main::run(), how can I now change the text of a label?

We’re using gtkmm-2.4 (and no, we cannot upgrade)

Any help is appreciated.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T03:14:38+00:00Added an answer on May 28, 2026 at 3:14 am

    Wow! That’s complicated…

    First: you should not manipulate windows from several threads. That is you should have just one GUI thread that does all the GUI work, and let the other threads communicate with it.

    It is theoretically possible to make it work (in Linux; in Windows it is impossible) but it is more trouble than it is worth.

    Second: the line Gtk::Main main(argc, argv) is not a call, it is an object declaration. The object main should live for the duration of the program, so if you use it in a object constructor, as soon as you return from it, the object will be destroyed! Just put it at the top of the main function and forget about it.

    UPDATE: My usual approach here is to create a pipe, a g_io_channel to read, and write bytes on the other end.

    Other option, although I didn’t test it is to call get the GMainContext of the main thread and then g_idle_source_new() and attach that source to the main context with g_source_attach(). If you try this one and it works, please post your result here!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Our project contains several classes that we have equals() and hashCode() methods generated by
Our issue is that our project has files being downloaded using wget to the
In our project we have requirement that, after receiving sms message from third party
Our project is using Ext-js, and sometimes will send several request to Rails. This
In our project we are using ValidationEngine, and we don't have the ability to
Our project uses XJC to generate Java classes from an XSD. I'm using JAVA
Our project has a site template that manages custom properties using SPWeb.Properties. However I
Our project is using a nightly backup application that simply makes a duplicate of
Our project contains 2600 class files and we have decided to start using automated
Our project is held in a SourceSafe database. We have an automated build, which

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.