[gtkmm/gtkmm-3-4] Application: Don't call add_window() before the application is registered.
- From: Murray Cumming <murrayc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtkmm/gtkmm-3-4] Application: Don't call add_window() before the application is registered.
- Date: Sat, 1 Sep 2012 00:47:00 +0000 (UTC)
commit ab8aeed292da5f22cc85dcebeeb669670099c71a
Author: Kjell Ahlstedt <kjell ahlstedt bredband net>
Date: Wed Aug 29 19:32:28 2012 +0200
Application: Don't call add_window() before the application is registered.
* gtk/src/application.[hg|ccg]: Move the call to add_window() from
run(Window& window, int argc, char** argv) and run(Window& window) to
on_activate_show_main_window() and rename it to
on_activate_add_and_show_main_window(). Bug #681323.
ChangeLog | 9 +++++++++
gtk/src/application.ccg | 23 ++++++++++++-----------
gtk/src/application.hg | 2 +-
3 files changed, 22 insertions(+), 12 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 63b3af1..0b08fca 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2012-08-29 Kjell Ahlstedt <kjell ahlstedt bredband net>
+
+ Application: Don't call add_window() before the application is registered.
+
+ * gtk/src/application.[hg|ccg]: Move the call to add_window() from
+ run(Window& window, int argc, char** argv) and run(Window& window) to
+ on_activate_show_main_window() and rename it to
+ on_activate_add_and_show_main_window(). Bug #681323.
+
2012-07-16 Murray Cumming <murrayc murrayc com>
Show get_type() in the API documentation.
diff --git a/gtk/src/application.ccg b/gtk/src/application.ccg
index a2f120f..a3b6091 100644
--- a/gtk/src/application.ccg
+++ b/gtk/src/application.ccg
@@ -127,13 +127,12 @@ int Application::run(int argc, char** argv)
int Application::run(Window& window, int argc, char** argv)
{
- add_window(window);
-
- //We cannot show the window until GApplication::activate has been
- //called, or we will crash because the application has not been "registered".
+ //We cannot add and show the window until the GApplication::activate signal
+ //has been emitted, or we will crash because the application has not been
+ //registered. (At least if window is an ApplicationWindow.)
signal_activate().connect(
sigc::bind(
- sigc::mem_fun(*this, &Application::on_activate_show_main_window),
+ sigc::mem_fun(*this, &Application::on_activate_add_and_show_main_window),
&window));
const int result = Gio::Application::run(argc, argv);
@@ -146,13 +145,12 @@ int Application::run(Window& window)
g_assert(m_argc);
g_assert(m_argv);
- add_window(window);
-
- //We cannot show the window until GApplication::activate has been
- //called, or we will crash because the application has not been "registered".
+ //We cannot add and show the window until the GApplication::activate signal
+ //has been emitted, or we will crash because the application has not been
+ //registered. (At least if window is an ApplicationWindow.)
signal_activate().connect(
sigc::bind(
- sigc::mem_fun(*this, &Application::on_activate_show_main_window),
+ sigc::mem_fun(*this, &Application::on_activate_add_and_show_main_window),
&window));
const int result = Gio::Application::run(m_argc, m_argv);
@@ -168,10 +166,13 @@ int Application::run()
return result;
}
-void Application::on_activate_show_main_window(Window* window)
+void Application::on_activate_add_and_show_main_window(Window* window)
{
if(window)
+ {
+ add_window(*window);
window->show();
+ }
}
diff --git a/gtk/src/application.hg b/gtk/src/application.hg
index 7f42c98..9150afa 100644
--- a/gtk/src/application.hg
+++ b/gtk/src/application.hg
@@ -200,7 +200,7 @@ private:
*/
const Glib::Class& custom_class_init();
- void on_activate_show_main_window(Window* window);
+ void on_activate_add_and_show_main_window(Window* window);
void on_window_hide(Window* window);
//We need these to call g_application_run(),
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]