Commit graph

3577 commits

Author SHA1 Message Date
Bertrand Lorentz
bfc89a1555 build: Only check the mono prefix when using mono
This avoids strange message at the end of configure with .Net
2014-02-23 16:59:50 +01:00
Bertrand Lorentz
84993d237f build: Remove obsolete gcc flag when building on Windows
The -mno-cygwin parameter has been obsolete for quite some time. It is
now gone in recent gcc version, causing an error when you try to use it.

My understanding that gcc now does the right thing automatically.
2014-02-23 16:41:07 +01:00
Bertrand Lorentz
2fcd276b9c build: Fix compiler parameters in gio and gtk-gio samples
Having parameters starting with a forward slash seems to break when
building with MinGW on Windows. So we use a dash to be consistent with
other Makefiles.

Also use the CSFLAGS variable in the sample/gio Makefile, instead of
hardcoding the debug flag.
2014-02-23 16:36:03 +01:00
Bertrand Lorentz
49295c119b build: Only build gui-thread-check profiler module on mono
The profiler module will only work with mono, so we don't need to build
it on Windows with the .Net framework.
2014-02-23 16:18:28 +01:00
Bertrand Lorentz
8a9f49e2b0 Add *.pdb to .gitignore 2014-02-23 16:09:14 +01:00
Bertrand Lorentz
691de4e606 gtk: Fix dll name and use a const for all DllImports in custom code
In Windows builds of GTK+ 3.x, the dll filename is libgtk-3-0.dll.

We use this opportunity to use a common const in the DllImport
statement for all custom code.
2014-02-23 15:12:20 +01:00
Bertrand Lorentz
ee8499483e generator: Fix signature of static method overloads
For method with optional parameters, when generating the overload
without the optional parameters, mark the overload as static if the
original method is static.
2014-01-05 17:28:30 +01:00
Bertrand Lorentz
3ea36f5746 build: Post-release version bump to 2.99.3 2013-12-04 22:28:23 +01:00
Bertrand Lorentz
73834cb7cb release: Small adjustments to NEWS for 2.99.2 2013-12-04 21:58:18 +01:00
Bertrand Lorentz
1c081cc728 doc: Remove the GLib/Dbus.xml file, it's replaced by GLib/DBus.xml
The class was renamed some time ago, but the automatic update of the
docs didn't catch the removal of the old file.
2013-12-04 21:54:01 +01:00
Bertrand Lorentz
b519e50a99 doc: Remove obsolete gen-finalize-docs.cs tool
It was used to automatically document the Finalize methods, which do not
exist anymore. We are now using the standard Dispose pattern, and the
Dispose methods only appear in a few places, so they can be documented
manually.
2013-12-04 21:42:27 +01:00
Bertrand Lorentz
087659639a doc: Auto-fill docs for virtual methods using gen-vm-docs tool 2013-12-04 21:28:00 +01:00
Bertrand Lorentz
a9a9c407a9 doc: Auto-fill docs for IntPtr constructors using gen-intptr-ctor-docs
The gen-intptr-ctor-docs automatically fills in the boilerplate
documentation for the IntPtr constructors.
2013-12-04 21:23:25 +01:00
Bertrand Lorentz
621b35002d doc: Auto-fill docs for GType properties using gen-gtype-docs tool
The gen-gtype-docs automatically fills in the documentation for all
GType properties.
2013-12-04 21:19:59 +01:00
Bertrand Lorentz
d562727254 doc: Remove obsolete gen-gtype-ctor-docs tool
It was used to document obsolete constructors with a GType parameter.
Those are gone now, so we don't need the tool anymore.
2013-12-04 21:14:44 +01:00
Bertrand Lorentz
bd36de9300 doc: Auto-fill docs for event handler using gen-handlerargs-docs tool
Compiling gen-handlerargs-docs.cs and running it on all assemblies
automatically fills in some documentation for event handlers.
2013-12-04 21:05:03 +01:00
Bertrand Lorentz
4593870178 doc: Add a bit of documentation for Widget.OnDrawn 2013-12-04 20:42:05 +01:00
Bertrand Lorentz
49f1bb86aa release: Update NEWS for upcoming 2.99.2 release 2013-12-01 17:06:26 +01:00
Bertrand Lorentz
cf7aa5222e sample: Fix leak in Scribble sample when resizing the window 2013-12-01 16:06:50 +01:00
Bertrand Lorentz
bc309f3093 doc: Run the automatic documentation updater 2013-11-30 16:01:53 +01:00
Andrés G. Aragoneses
8aaed84e5e cairo: Fix remaining leaks when finalizer gets called
Apply same finalizer leak fix to the rest of IDisposable-ownership
cairo classes as the one recently committed for Cairo.Context[1].

[1] https://github.com/mono/gtk-sharp/commit/41eeecbf9a6d8
2013-11-30 15:34:29 +01:00
Bertrand Lorentz
694357cc5b build: Fix typo in sample/Makefile.am 2013-11-24 16:46:13 +01:00
Andrés G. Aragoneses
70d1827058 cairo: Throw ObjectDisposedException after an object has been disposed
Potentially all these IDisposable classes could be used after being
disposed, which would result in native crashes. We now do an explicit
check and throw an exception in managed land when the object has been
disposed.

This is particularly useful because:
 a/ the native crashes are quite obscure, there no indication that
you're using a disposed object
 b/ Gtk# is passing Context instances to user methods, and disposes them
when the method returns. So if the user code keeps a reference to the
Context, there a good chance it will try to use it after it's disposed.

Other changes in this patch include:
 * Renaming a parameter to be more consistent with the other subsequent
ctor called.
 * Replacing implementation of some [Obsolete()] methods with the call
to the methods they were replaced with, to avoid redundancy and the
need for more CheckDisposed() calls than necessary.
 * Throw ArgumentException when receiving an IntPtr.Zero as a handle,
as a way to protect ourselves from wrapping invalid native pointers,
and throwing ObjectDisposedExceptions because the object was invalid in
the first place.

Signed-off-by: Bertrand Lorentz <bertrand.lorentz@gmail.com>
2013-11-24 15:56:26 +01:00
Bertrand Lorentz
21b081b6a9 sample: Add sample that uses only cairo and writes image files
The sample writes the same PNG file over and over, with some pauses in
between iterations. Some indicative numbers are written to the console,
to help track performance and memory usage.

Feel free to add more elaborate drawing to this sample, to exercise more
of the cairo API.
2013-11-24 15:22:05 +01:00
Bertrand Lorentz
51f102bc34 generator: Dispose ownable parameters in signal callbacks (bxc#237)
A similar situation to what is described in commit e48ac63d54 also
happens with signal callbacks: some signals are passed a native object
that is wrapped in an IDisposable managed object, which is then passed
as an argument to the signal handler. We need to dispose those objects
when the signal handler is done.

Those parameters will now be disposed in a finally {...} block, after
the signal handler has returned. This means that handlers should not
keep a reference to such a parameter, as it will be disposed right after
they return.

This change only affects the Cairo.Context parameter of the Widget.Drawn
signal, but it was badly needed, as shown by the Pixbuf demo in the
GtkDemo sample, which was leaking tens of MBs of memory.
2013-11-17 19:10:24 +01:00
Bertrand Lorentz
b7df1d2e13 generator: Fix indentation in Signal.cs
Only whitespace changes, no real code change.
2013-11-17 17:17:57 +01:00
Bertrand Lorentz
2d48906523 glib: Use Marshaller methods in Argv for g_malloc and g_free 2013-11-17 16:27:39 +01:00
Bertrand Lorentz
ced6f5e677 glib: Avoid unnecessary qualifier in Marshaller.PtrToStringArrayGFree 2013-11-17 16:26:02 +01:00
Bertrand Lorentz
32d10bd319 Use GLib.Marshaller.Free instead of calling g_free directly
Using the GLib.Marshaller.Free method means we don't need to have the
g_free function definition duplicated all over the place.
2013-11-17 16:20:02 +01:00
Bertrand Lorentz
f067f5112d glib: Remove obsolete Argv-related methods in Marshaller
The ArgvToArrayPtr and ArrayPtrToArgv have been marked obsolete since
2004, and removing them allows us to remove some more code.
2013-11-17 15:05:36 +01:00
Bertrand Lorentz
c2f9035625 generator: Fix small typo in a comment in LPUGen.cs 2013-11-17 13:32:03 +01:00
Bertrand Lorentz
ee06530b52 glib: Avoid doing the same cast twice in KeyFile.ToData
The cast from UIntPtr to int can fail at runtime, but if your config
file is more than 2^31 bytes, you probably have bigger problems...
2013-11-17 13:27:04 +01:00
Andrés G. Aragoneses
f1005da47c glib: Make all DllImports in custom code use a common const
This way there's less redundancy, and if the library name changes in the
future, it will be changed only in one place.

Signed-off-by: Bertrand Lorentz <bertrand.lorentz@gmail.com>
2013-11-17 13:05:12 +01:00
Bertrand Lorentz
d6f06860fb Merge pull request #90 from knocte/embedded
gtk: fix Application to be more robust when embedding mono
2013-11-09 08:10:06 -08:00
Bertrand Lorentz
859832f6e4 Merge pull request #89 from knocte/master
glib: fix IntPtr.Zero being dereferenced in GLib.Value.ToBoxed()
2013-11-09 08:08:40 -08:00
Bertrand Lorentz
e48ac63d54 generator: Dispose ownable method parameters in VM callback (bxc#237)
Some virtual methods are passed a native object that is wrapped in an
IDisposable managed object, which is then passed on to the managed
overrides. We need to dispose those objects as soon as possible,
otherwise their native counterpart will not be freed until the next
garbage collection. Requiring the overrides to dispose them would be
cumbersome and error-prone.

Those parameters will now be disposed in a finally {...} block, after
the virtual method has returned. This means that overrides should not
keep a reference to such a parameter outside of the scope of the method,
as it will be diposed when the method returns.

This change only affects Cairo.Context parameter for now, but it was
particularly needed for them, as they could happily hold on to tens of
MBs of memory until the next garbage collection.
2013-11-09 16:26:17 +01:00
Andrés G. Aragoneses
2967482762 Revert "gtk: Mark the Cairo.Context in Widget.Drawn as owned"
This reverts commit 21bfaa7a9d.

After fixing the memory leak when finalizing a Context object in the
previous commit, native crashes would happen when using a Gtk#-based
app. The reason is that this commit tried to fix the leak with the wrong
approach of marking the CairoContext as owned. This avoided the leak by
not incrementing the reference count, but now that the leak is fixed,
cairo_destroy is called one time too much.

The CairoContext passed in the Draw signal is not marked as
transfer-ownership=full in GObject-Introspection metadata. So unmarking
this as owned fixes the "potential double-free" assertion that was
causing the crash.
2013-11-03 17:01:34 +01:00
Andrés G. Aragoneses
53e884dd22 gtk: fix Application to be more robust when embedding mono
When embedding mono, Environment.GetCommandLineArgs() would not return
an array with any element.

Reported in the mailing list, by Vardar Sahin.
2013-11-03 16:11:42 +01:00
Andrés G. Aragoneses
41eeecbf9a cairo: fix leak when Context object is finalized
When the finalizer calls Dispose(), disposing is false, it means that
CairoDebug traces should be printed, but the reference count on the
native context should still be decreased. Otherwise a real leak
would appear, as the native context would never be freed when the
managed object is GCed.
2013-11-03 15:21:49 +01:00
Bertrand Lorentz
fc9746013d gtk: Fix TreeView.GetTooltipContext method signature (bxc#14678)
The x and y parameters of gtk_tree_view_get_tooltip_context() are marked
as inout in the Gtk+ docs, so we need to mark them as ref.
2013-11-03 14:42:39 +01:00
Stephan Sundermann
cfdbb3b9a7 glib: fix IntPtr.Zero being dereferenced in GLib.Value.ToBoxed() 2013-11-02 16:52:25 +01:00
Bertrand Lorentz
0d781f485f gio: Delete DBusInterfaceVTable class
It was never included in the build, and never modified since it was
first created.
2013-11-02 15:53:29 +01:00
Andrés G. Aragoneses
10546e2ffa MSBuild: fix the solution build (except audit and sample projects)
This commit makes it possible to build any project of the gtk-sharp.sln
from an IDE (except audit and sample projects, which require a bit more
work).

This doesn't mean that autotools is deprecated, but just that it is more
comfortable to use an IDE when working on gtk-sharp because it will
offer better auto-completion, and will stop highlight misleading
semantic errors, from now on.
2013-11-02 15:48:58 +01:00
Andrés G. Aragoneses
efdf6463bb Simplify instructions about choosing the installation prefix
Clarify the README thanks to the use of pkg-config, and add a
configure-time warning so people notice about the problem without having
to read the README.
2013-11-02 15:33:31 +01:00
Lluis Sanchez
78fd18e0b7 Merge pull request #88 from knocte/guithreadcheck_whitelist
gui-thread-check: add two more methods to the whitelist
2013-10-31 02:22:31 -07:00
Andrés G. Aragoneses
7dafb39c01 gui-thread-check: add two more methods to the whitelist
At application shutdown, it's very likely to be spammed by
gui-thread-check with a river of:

*** GTK CALL NOT IN GUI THREAD: Widget.Dispose
*** GTK CALL NOT IN GUI THREAD: Widget.remove_InternalDestroyed
*** GTK CALL NOT IN GUI THREAD: Widget.Dispose
*** GTK CALL NOT IN GUI THREAD: Widget.remove_InternalDestroyed
...

From what I gather, these two methods (in gtk-sharp master[1]) could
be called by the finalizers, but do not call any unmanaged functions,
so it should be ok to not report them as violations.

[1] https://github.com/mono/gtk-sharp/blob/master/gtk/Widget.cs

Cherry-picked from 77a40599ca
2013-10-31 10:18:02 +01:00
Lluis Sanchez
68c64bedc0 Merge pull request #87 from knocte/guithreadcheck_fflush
gui-thread-check: use fflush() after printf()
2013-10-30 11:14:21 -07:00
Andrés G. Aragoneses
dcc2850a39 gui-thread-check: use fflush() after printf()
Using fflush() right away after printf() calls avoids the buffers to
be written in an apparently complete-out-of-sync way from the point
of view of the developer. This problem would specially occur when
redirecting all output to a file this way:

  mono Foo.exe > out.txt 2>&1

Without this fix, all the output from gui-thread-check would appear
at the end of the file, instead of in between the output generated by
the program.

Cherry-picked from 6988cd4cd2
2013-10-28 21:57:29 +01:00
Bertrand Lorentz
21ef50ec48 Merge pull request #83 from knocte/msbuild_tweaks
Various tweaks and updates to the .csproj files
2013-10-22 12:55:30 -07:00
Bertrand Lorentz
bd9cde5e61 Merge pull request #82 from knocte/cleanup
Various small cleanups in generator and glib
2013-10-22 12:52:08 -07:00