All of lore.kernel.org
 help / color / mirror / Atom feed
From: Namhyung Kim <namhyung@kernel.org>
To: Pekka Enberg <penberg@kernel.org>
Cc: Arnaldo Carvalho de Melo <acme@ghostprotocols.net>,
	Ingo Molnar <mingo@kernel.org>,
	Peter Zijlstra <peterz@infradead.org>,
	LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] perf ui/gtk: Ensure not to call gtk_main_quit() twice
Date: Mon, 20 Aug 2012 10:50:21 +0900	[thread overview]
Message-ID: <878vdajpr6.fsf@sejong.aot.lge.com> (raw)
In-Reply-To: <CAOJsxLEZjxa1ySfVJeD-GJ5_Gi=nJTn40rCSu+PHhXjwn633oQ@mail.gmail.com> (Pekka Enberg's message of "Sat, 18 Aug 2012 10:52:03 +0300")

On Sat, 18 Aug 2012 10:52:03 +0300, Pekka Enberg wrote:
> On Fri, Aug 17, 2012 at 7:56 PM, Namhyung Kim <namhyung@kernel.org> wrote:
>> Currently the gtk_main_quit() is called twice when perf exits so the
>> following warning is emitted:
>>
>>   [penberg@tux perf]$ ./perf report --gtk
>>   ^Cperf: Interrupt
>>
>>   (perf:4048): Gtk-CRITICAL **: IA__gtk_main_quit: assertion `main_loops != NULL' failed
>>
>> Fix it by not to call it unnecessarily.
>>
>> Reported-by: Pekka Enberg <penberg@kernel.org>
>> Signed-off-by: Namhyung Kim <namhyung@kernel.org>
>> ---
>>  tools/perf/ui/gtk/setup.c |    2 ++
>>  1 file changed, 2 insertions(+)
>>
>> diff --git a/tools/perf/ui/gtk/setup.c b/tools/perf/ui/gtk/setup.c
>> index ad40b3626fdb..ec1ee26b485a 100644
>> --- a/tools/perf/ui/gtk/setup.c
>> +++ b/tools/perf/ui/gtk/setup.c
>> @@ -13,6 +13,8 @@ int perf_gtk__init(void)
>>
>>  void perf_gtk__exit(bool wait_for_ok __used)
>>  {
>> +       if (!perf_gtk__is_active_context(pgctx))
>> +               return;
>>         perf_error__unregister(&perf_gtk_eops);
>>         gtk_main_quit();
>>  }
>
> Wouldn't it be nicer to rearrange the callers so that perf_gtk__exit()
> is not called twice?

You mean this?


diff --git a/tools/perf/ui/setup.c b/tools/perf/ui/setup.c
index c7820e569660..d25e145e9a89 100644
--- a/tools/perf/ui/setup.c
+++ b/tools/perf/ui/setup.c
@@ -2,6 +2,7 @@
 
 #include "../cache.h"
 #include "../debug.h"
+#include "gtk/gtk.h"
 
 
 pthread_mutex_t ui__lock = PTHREAD_MUTEX_INITIALIZER;
@@ -37,7 +38,8 @@ void exit_browser(bool wait_for_ok)
 {
 	switch (use_browser) {
 	case 2:
-		perf_gtk__exit(wait_for_ok);
+		if (perf_gtk__is_active_context(pgctx))
+			perf_gtk__exit(wait_for_ok);
 		break;
 
 	case 1:


  reply	other threads:[~2012-08-20  1:57 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-08-17 16:56 [PATCH] perf ui/gtk: Ensure not to call gtk_main_quit() twice Namhyung Kim
2012-08-18  7:52 ` Pekka Enberg
2012-08-20  1:50   ` Namhyung Kim [this message]
2012-08-20  1:55     ` Namhyung Kim
2012-08-20  1:59       ` Namhyung Kim
2012-08-20  5:04         ` Pekka Enberg
2012-08-21 16:29 ` [tip:perf/core] perf ui gtk: " tip-bot for Namhyung Kim

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=878vdajpr6.fsf@sejong.aot.lge.com \
    --to=namhyung@kernel.org \
    --cc=acme@ghostprotocols.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=penberg@kernel.org \
    --cc=peterz@infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.