I will be more than grateful if you could find time for answering me.General:
I am writing a GUI, in which I receive real time video from several cameras of a robot (using ROS).The problem:
Everything works perfectly, until the stage I want to close the top level window (by clicking the X button).
The window is destroyed, but I receive this critical warning:
Gtk-CRITICAL **: IA__gtk_main_quit: assertion `main_loops != NULL' failedMy analysis:
I connect the "destroy" signal to the function "gtk_main_quit" in the next way:
g_signal_connect( G_OBJECT(globalTopLevelWindow), "destroy", G_CALLBACK(gtk_main_quit), NULL );
After analysing the code I have inferred that this warning is thrown by this line of code:
g_return_if_fail (main_loops != NULL)
which is the first line of "gtk_main_quit" function.
And it means that there are no main loops executing when the process is in this line of code.The questions:
1. Actually I don´t understand why the warning exists? It is OK, the assertion should fail. Am I right? Should I ignore this? Hmm...:-\
2. How can I fix this?
Thanks in advance,
Felix.P.S. The code of my main (for your convenience):
int main(int argc, char **argv)
ros::init(argc, argv, "image_listener");
ros::Rate loop_rate(100); // Rate class instance.
ImageManagmentStruct LeftCameraImageStruct, RightCameraImageStruct, KinectImageStruct; // Structs for image menagment.
// Getting the resizing parameter from the launch file.
if ( !nh.getParam("resizing_factor", globalResizingFactor) )
ROS_ERROR ("The resizing factor was not loaded succesfully. Aborting...\n");
// Initializing the image/camera data structures.
dataStructuresInitialization ( &LeftCameraImageStruct, &RightCameraImageStruct, &KinectImageStruct );
// GTK library initialization
gtk_init ( &argc, &argv );
// Creating a top level window and connecting it to a sygnal.
// Creating a fixed container, which will hold all the widgets of the GUI.
// Creating a GtkGrid widget, which will contain all the images.
// Attaching the created table to the Container.
gtk_fixed_put (GTK_FIXED (pGlobalFixedContainer), pGlobalGtkTable, IMAGES_HORIZONTAL_PLACEMENT, IMAGES_VERTIACL_PLACEMENT);
// Subscribing in order to receive images.
ros::Subscriber subLeft = nh.subscribe<sensor_msgs::Image> ("leftCameraTopic", 10, boost::bind(imageCallback, _1, globalArrayOfImages));
ros::Subscriber subRight = nh.subscribe<sensor_msgs::Image> ("rightCameraTopic", 10, boost::bind(imageCallback, _1, globalArrayOfImages));
ros::Subscriber subKinect = nh.subscribe<sensor_msgs::Image> ("kinectCameraTopic", 10, boost::bind(imageCallback, _1, globalArrayOfImages));
while ( ros::ok() )
// Showing the main window, with the attached image.
if ( GTK_IS_WIDGET (globalTopLevelWindow) )
gtk_widget_show_all ( globalTopLevelWindow );
ROS_INFO ("The top level window of the application was closed...Exiting the program.\n");
// Allowing "imageCallback" to be called.
// Running the main GTK iteration loop.