After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 93694 - Glib::Dispatcher and arbitrary MainContext
Glib::Dispatcher and arbitrary MainContext
Status: RESOLVED FIXED
Product: gtkmm
Classification: Bindings
Component: general
2.0
Other All
: Normal enhancement
: ---
Assigned To: gtkmm-forge
gtkmm-forge
Depends on:
Blocks:
 
 
Reported: 2002-09-19 19:37 UTC by Stephan Puchegger
Modified: 2004-12-22 21:47 UTC
See Also:
GNOME target: ---
GNOME version: Unversioned Enhancement


Attachments
the patch adds the possibility to use an arbitrary MainContext (3.47 KB, patch)
2002-09-19 19:38 UTC, Stephan Puchegger
none Details | Review
New complete patch. includes modifications in examples/threads/Makefile.am for now dispatcher example (next attachment) (4.48 KB, patch)
2002-09-21 08:59 UTC, Stephan Puchegger
none Details | Review
new file: examples/thread/dispatcher2.cc (additional dispatcher example) (5.64 KB, text/plain)
2002-09-21 09:01 UTC, Stephan Puchegger
  Details

Description Stephan Puchegger 2002-09-19 19:37:06 UTC
The signal in the DispatcherNotifier connect only to the default
MainContext. The proposed enhancement offers the possibility to 
use an arbitrary MainContext.The patch adds an additional constructor
to Glib::Dispatcher, that accepts a reference to Glib::RefPtr<MainContext>
an connects the DispatcherNotifier signal to that context.
Comment 1 Stephan Puchegger 2002-09-19 19:38:29 UTC
Created attachment 11174 [details] [review]
the patch adds the possibility to use an arbitrary MainContext
Comment 2 Murray Cumming 2002-09-20 08:04:15 UTC
I think the constructor should be marked "explicit".

I think Daniel Elstner needs to approve this patch.
Comment 3 Stephan Puchegger 2002-09-20 08:19:41 UTC
You are right. Making it "explicit" would be better. Sorry, that I did 
not do it.

As a test for the patch I modified Daniel Elstner's dispatcher example.
The modified version contains 2 mainloops which a dispatcher signal in
each direction. It worked with no obvious problems. I may of course
have overlooked something. Is there any interest for an additional
dispatcher example if this patch is accepted? 
Comment 4 Murray Cumming 2002-09-20 14:28:23 UTC
Yes, an example would probably be helpful.
Comment 5 Stephan Puchegger 2002-09-20 14:46:55 UTC
I will clean up and comment the example tomorrow and attach it to this
bug as another patch against the cvs tree.
Comment 6 Stephan Puchegger 2002-09-21 08:59:55 UTC
Created attachment 11199 [details] [review]
New complete patch. includes modifications in examples/threads/Makefile.am for now dispatcher example (next attachment)
Comment 7 Stephan Puchegger 2002-09-21 09:01:26 UTC
Created attachment 11200 [details]
new file: examples/thread/dispatcher2.cc (additional dispatcher example)
Comment 8 Stephan Puchegger 2002-09-21 09:20:37 UTC
Could not build todays CVS tree because some directory was missing 
(tests/dialog or something similar) and autogen.sh complained.The
files that were also included in the first patch (dispatcher.cc and
dispatcher.h from glib/glibmm) built last time I tried (before I
submitted the first patch) and the new example builds fine with a
patched version of gtkmm-1.3.23, which is the same as the cvs version
in the critical areas. The only minor change to dispatcher.h is the
addition of "explicit". The only thing I could not try to build was
the modified Makefile.am in the examples/thread directory, but I am
pretty sure its fine.
Comment 9 Stephan Puchegger 2002-09-21 11:09:39 UTC
Line 89 of the example should better be something like
    
// Create a joinable thread -- it needs to be joined, otherwise its a
memory leak

sorry
Comment 10 Daniel Elstner 2002-09-21 11:55:53 UTC
I just applied your first patch with some modifications (mostly
reducing code duplication).  Thanks.  I'm going to look at your
example now.

Erm, try cvs update -Pd to get new directories.
Comment 11 Daniel Elstner 2002-09-21 19:55:36 UTC
OK, the example is in CVS now.  Thanks for your work.

There were some memory visibility problems in the code which I
(hopefully) fixed, apart from a few stylistic issues.  Could you
please have a look at my changes in case I did something that wasn't
intended?

--Daniel
Comment 12 Stephan Puchegger 2002-09-21 21:50:44 UTC
Hej Daniel!

Everything you did is perfect! And don't thank me - I am the one who
should be (and who is) grateful.You are all doing a great job! Thanks
for incorporating the patch and the example. I did learn a few things
from the way you fixed it.

Thanks a lot! Danke schön!

Stephan
Comment 13 Daniel Elstner 2002-09-22 13:58:36 UTC
Heh, kein Problem ;)