Neler yeni
XenForo Bannerlar
Modern AdBlock Uyarısı

Foruma hoş geldin, Ziyaretçi

Forum içeriğine ve tüm hizmetlerimize erişim sağlamak için foruma kayıt olmalı ya da giriş yapmalısınız. Foruma üye olmak tamamen ücretsizdir.

Kod Sanii switchbot - Memory Leak Fix

Fatih Bulut

Süper Üye
Katılım
6 Kas 2021
Mesajlar
4,066
Tepkime puanı
5,491
Puanları
113
Yaş
32
Konum
Türkiye
Dc
fatihbulut
Yapalı baya oldu o yüzden %100 case'i hatırlamıyorum ama event devam ederken iptal etmeye çalışıldığı için core crash yaşanıyordu, windows geliştirme ortamında yaşamıştım yanlış hatırlamıyorsam freebsd'de sorun olmayabilir:


new_switchbot.h


Arat:
Kod:
void Pause();
Altına Ekle:
Kod:
void ClearEvent(); // Clear event pointer (called from event handler)
new_switchbot.cpp

Arat:
Kod:
info->pkSwitchbot->SwitchItems();
Altına Ekle:
Kod:
    if (!info->pkSwitchbot->HasActiveSlots())
    {
        info->pkSwitchbot->ClearEvent(); // Clear event pointer
        return 0; // Stop event
    }
Arat:
Kod:
void CSwitchbot::Pause()
{
    if (m_pkSwitchEvent)
    {
        event_cancel(&m_pkSwitchEvent);
        m_pkSwitchEvent = nullptr;
    }
}
Altına Ekle:

Kod:
void CSwitchbot::ClearEvent()
{
    m_pkSwitchEvent = nullptr;
}
Arat:
Kod:
info->pkSwitchbot->SwitchItems();
Altına Ekle:
Kod:
    if (!info->pkSwitchbot->HasActiveSlots())
    {
        info->pkSwitchbot->ClearEvent(); // Clear event pointer
        return 0; // Stop event
    }
Arat:
Kod:
            if (!HasActiveSlots())
            {
İf bloğunu değiştir:
Kod:
                memset(&m_table.active, 0, sizeof(m_table.active));
                CSwitchbotManager::Instance().SendSwitchbotUpdate(m_table.player_id);
                return; // Exit early - event will stop when it returns 0
Arat:
Kod:
if (stop)
if bloğunu değiştir:
Kod:
            if (stop)
            {
                // Don't call Stop() here - we're inside the event handler
                // Just clear active flags and notify player
                memset(&m_table.active, 0, sizeof(m_table.active));

                if (SWITCHBOT_PRICE_TYPE == 1)
                    pkOwner->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("Switchbot stopped. Out of switchers."));
                else
                    pkOwner->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("Switchbot stopped. Not enough money."));

                CSwitchbotManager::Instance().SendSwitchbotUpdate(m_table.player_id);
                return;
            }
 
  Benzer konular Forum Tarih
Python / C++/ C# 1 735

Benzer konular

Forumdan daha fazla yararlanmak için giriş yapın yada üye olun!

Forumdan daha fazla yararlanmak için giriş yapın veya kayıt olun!

Kayıt ol

Forumda bir hesap oluşturmak tamamen ücretsizdir.

Şimdi kayıt ol
Giriş yap

Eğer bir hesabınız var ise lütfen giriş yapın

Giriş yap

Tema düzenleyici

Tema özelletirmeleri

Grafik arka planlar

Granit arka planlar