diff options
author | kuchhal@chromium.org <kuchhal@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-10-14 20:16:23 +0000 |
---|---|---|
committer | kuchhal@chromium.org <kuchhal@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-10-14 20:16:23 +0000 |
commit | cebf3196a5fbb525c93247b24f970a8b885518d9 (patch) | |
tree | 0e4fd8adc4f729464270a4a03cbcfb5223ab83da /chrome/browser/gtk/first_run_dialog.cc | |
parent | 58db2f88917448f794deeee45868137d9098339a (diff) | |
download | chromium_src-cebf3196a5fbb525c93247b24f970a8b885518d9.zip chromium_src-cebf3196a5fbb525c93247b24f970a8b885518d9.tar.gz chromium_src-cebf3196a5fbb525c93247b24f970a8b885518d9.tar.bz2 |
Linux: Prevent another Chrome instance when First Run UI is active.
BUG=24485
TEST=On Ubuntu, delete 'First Run' file and launch Chrome to bring up First Run UI and then again launch Chrome which should not crash.
Review URL: http://codereview.chromium.org/278006
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@29007 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/gtk/first_run_dialog.cc')
-rw-r--r-- | chrome/browser/gtk/first_run_dialog.cc | 32 |
1 files changed, 20 insertions, 12 deletions
diff --git a/chrome/browser/gtk/first_run_dialog.cc b/chrome/browser/gtk/first_run_dialog.cc index aab26cb..18a4b5a 100644 --- a/chrome/browser/gtk/first_run_dialog.cc +++ b/chrome/browser/gtk/first_run_dialog.cc @@ -8,6 +8,7 @@ #include "app/resource_bundle.h" #include "base/message_loop.h" #include "chrome/browser/gtk/gtk_chrome_link_button.h" +#include "chrome/browser/process_singleton.h" #include "chrome/browser/shell_integration.h" #include "chrome/common/gtk_util.h" #include "chrome/common/platform_util.h" @@ -21,9 +22,26 @@ #endif // static -bool FirstRunDialog::Show(Profile* profile) { +bool FirstRunDialog::Show(Profile* profile, + ProcessSingleton* process_singleton) { int response = -1; - new FirstRunDialog(profile, response); + // Object deletes itself. + FirstRunDialog* first_run = new FirstRunDialog(profile, response); + + // Prevent further launches of Chrome until First Run UI is done. + process_singleton->Lock(GTK_WINDOW(first_run->dialog_)); + + // TODO(port): it should be sufficient to just run the dialog: + // int response = gtk_dialog_run(GTK_DIALOG(dialog)); + // but that spins a nested message loop and hoses us. :( + // http://code.google.com/p/chromium/issues/detail?id=12552 + // Instead, run a loop and extract the response manually. + g_signal_connect(G_OBJECT(first_run->dialog_), "response", + G_CALLBACK(HandleOnResponseDialog), first_run); + gtk_widget_show_all(first_run->dialog_); + MessageLoop::current()->Run(); + + process_singleton->Unlock(); return (response == GTK_RESPONSE_ACCEPT); } @@ -115,16 +133,6 @@ FirstRunDialog::FirstRunDialog(Profile* profile, int& response) } gtk_box_pack_start(GTK_BOX(content_area), vbox, FALSE, FALSE, 0); - - // TODO(port): it should be sufficient to just run the dialog: - // int response = gtk_dialog_run(GTK_DIALOG(dialog)); - // but that spins a nested message loop and hoses us. :( - // http://code.google.com/p/chromium/issues/detail?id=12552 - // Instead, run a loop and extract the response manually. - g_signal_connect(G_OBJECT(dialog_), "response", - G_CALLBACK(HandleOnResponseDialog), this); - gtk_widget_show_all(dialog_); - MessageLoop::current()->Run(); } void FirstRunDialog::OnDialogResponse(GtkWidget* widget, int response) { |