Hello,<div>I am developing a gtkmm (2.4) cross-platform application on Win32 using MSVC2008 (v 9). My app has dependency on cairomm (installed version 1.0). There is no problem compiling the application, however once run in debug mode the application encounters a breakpoint as described below</div>
<div><br></div><div>this is the code snippet where I create a cairo context for my custom widget.</div><div><br></div><div><div>void CNumParam::on_size_allocate(Gtk::Allocation &refAlloc)</div><div>{</div><div> Cairo::RefPtr<Cairo::Context> refCairo;</div>
<div><span class="Apple-tab-span" style="white-space:pre">        </span>Glib::RefPtr<Pango::Layout> refPango;</div><div> </div><div><span class="Apple-tab-span" style="white-space:pre">        </span>//Set allocation</div><div>
<span class="Apple-tab-span" style="white-space:pre">        </span>set_allocation(refAlloc);</div><div><br></div><div><span class="Apple-tab-span" style="white-space:pre">        </span>//Do the rest only if a windows is available</div>
<div><span class="Apple-tab-span" style="white-space:pre">        </span>if (m_refWnd) {</div><div><span class="Apple-tab-span" style="white-space:pre">                </span>//Get the cairo context of the window</div><div><span class="Apple-tab-span" style="white-space:pre">                </span>refCairo = m_refWnd->create_cairo_context();</div>
<div><br></div><div><span class="Apple-tab-span" style="white-space:pre">                </span>//Create a pango layout attatched to the cairo context</div><div><span class="Apple-tab-span" style="white-space:pre">                </span>refPango = Pango::Layout::create(refCairo);</div>
<div><br></div><div><span class="Apple-tab-span" style="white-space:pre">                </span>OnSizeAllocate(refPango, refAlloc);</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>}</div><div>}</div></div><div><br>
</div><div>As the Cairo::RefPtr variable goes out of scope, it begins to get deallocated since it is not been referenced from anywhere else, and thats when my program crashes. The assertion is encountered within "dbgdel.cpp" (an MSVC file).</div>
<div><br></div><div><div>void operator delete(void *pUserData)</div><div>{</div><div> _CrtMemBlockHeader * pHead;</div><div><br></div><div> RTCCALLBACK(_RTC_Free_hook, (pUserData, 0));</div><div><br></div><div>
if (pUserData == NULL)</div><div> return;</div><div><br></div><div> _mlock(_HEAP_LOCK); /* block other threads */</div><div> __TRY</div><div><br></div><div> /* get a pointer to memory block header */</div>
<div> pHead = pHdr(pUserData);</div><div><br></div><div> /* verify block type */</div><div><span class="Apple-style-span" style="font-weight: bold;"> _ASSERTE(_BLOCK_TYPE_IS_VALID(pHead->nBlockUse)); /*This is where my app gets stuck*/</span></div>
<div><br></div><div> _free_dbg( pUserData, pHead->nBlockUse );</div><div><br></div><div> __FINALLY</div><div> _munlock(_HEAP_LOCK); /* release other threads */</div><div> __END_TRY_FINALLY</div>
<div><br></div><div> return;</div><div>}</div><div><br></div><div>There are no problems when I compile in Release mode. Also I tried compiling the same code from Linux (FC9) using gcc no issues at all.</div><div><br>
</div><div>Am I using an old version of cairomm or are there any compatibility issues??</div><div><br></div><div>Thanks in advance</div><div>Mohith</div></div>