Re: python bindings GInitiallyUnowned issue



(Note: I keep forgetting to "reply to all" so resending what I have
replied in private.)

Hi,

On Wed, Jul 28, 2010 at 22:08, Ranen Ghosh <ranen ghosh gmail com> wrote:
> Hello, I find that calling ChamplainView object's set_map_source() with the
> result of champlain.file_cache_new_full() in python leads to errors..
>
>        self.tilecache = champlain.file_cache_new_full( 1,
>                                     '/home/rghosh/shared/test/jepp_osm',
>                                     True )
>
>        print "ref count 1", sys.getrefcount(self.tilecache)
>        sys.stdout.flush()
>        view.set_map_source( self.tilecache )
>        print "ref count 2", sys.getrefcount(self.tilecache)
>
> output:
>
> ref count 1 2
>
> ** (cluttertest.py:25857): CRITICAL **: get_min_zoom_level: assertion
> `CHAMPLAIN_IS_MAP_SOURCE (next_source)' failed
>
> ** (cluttertest.py:25857): CRITICAL **: get_max_zoom_level: assertion
> `CHAMPLAIN_IS_MAP_SOURCE (next_source)' failed
>
> ** (cluttertest.py:25857): CRITICAL **: get_license: assertion
> `CHAMPLAIN_IS_MAP_SOURCE (next_source)' failed
>
> ** (cluttertest.py:25857): CRITICAL **: get_tile_size: assertion
> `CHAMPLAIN_IS_MAP_SOURCE (next_source)' failed
>
> ** (cluttertest.py:25857): CRITICAL **: get_tile_size: assertion
> `CHAMPLAIN_IS_MAP_SOURCE (next_source)' failed
>
> ** (cluttertest.py:25857): CRITICAL **: get_tile_size: assertion
> `CHAMPLAIN_IS_MAP_SOURCE (next_source)' failed
> ref count 2 2
>
> I wonder if it's due to reference count issues in the python bindings, since
> ChamplainFileCache inherits from GInitiallyUnowned ?

No, the problem is in incorrect usage of file cache in your code.
Since 0.6 libchamplain uses "chains" of map sources - if a tile is not
found in one map source, the next map source in the chain is checked
and so on. In your case you have created the file cache only and use
it as a map source passed to the view. When the tile is not found, the
next source in the chain is checked, but it is NULL because you have
not set it and these are the warnings you see.

The correct (and easiest) way to do the thing you want is to create an
instance of ChamplainMapSourceChain and push an instance of
ChamplainErrorTileSource and ChamplainFileCache into it (in this
order). This will create the chain

ChamplainFileCache -> ChamplainErrorTileSource

ChamplainErrorTileSource is always successful so it never tries the
next source and just creates the error tile.

I expect you want to do something special - otherwise the easiest way
to create ready to use chains is to use the factory methods - see the
demos and the documentation how to use them.

Jiri

>
> Ranen
>
> _______________________________________________
> libchamplain-list mailing list
> libchamplain-list gnome org
> http://mail.gnome.org/mailman/listinfo/libchamplain-list
>


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]